Max,
as many parent processes model well to a state machine, at first glance what you are trying to accomplish is sequential with dependencies involved.
let's break down your system;
I need to implement a system like this:
1) Netduino controls a stepper.
>>are you using a ULN2003 device to control the stepper motor, just google uln2003 stepper motor and you will find many circuits like this. ULN2003 has built in diode projection for the CEMF build up in the 4 coils of a typical stepper motor.
2) Affter some step, Netduino must notify a windows form app that the motor has finished
>>suggest that you install a sense line that tells you when the stepper motor is actually running then feed this as an input to your system. Now, you will be able to sense when motor is actually ON or OFF, not depending blindly on the control commands. So use the sense line into digital input on Netduino. the windows forms app listens for this line and fires an event handler in the windows forms application.
3) The window app do some job, and after that notify Netduino.
>>that is just passing messages between a windows PC form application and the netduino application.
i have been creating c# based tools and electronic interface design/build for various clients since 2006. To have true system wide interaction with the device under test it is important to also provide device interaction via your SCPI programmable test equipment as well. I am currently working on an OOP design pattern so i can create custom remote control applications for any SCPI capable test gear provided that i have the OEM gear programmer's reference guide PDF file.
4) Netduino run the motor again
An so on.
the two tasks (motor stepping and the windows form app job) are very short: the motor runs for about half a second, the job consists in capturing an image from a web cam streaming and save it in a folder, so less than a second.
>>here, have you tried using the AutoResetEvent / ManualResetEvent?
Also, there are things that you can do in winform applications to give additional information in the form of different colored prompts, i.e. red background with yellow font implies error message, navy blue background with white font means status, green background with yellow font means input, ect.
Plus, is critical that none of the two actors fail a sigle phase.
I tried with Netduino Plus one, 4.2.0.1 Tried with a COM 2/COM1 communication, that failed because of the USB/RS232 cable, maybe for different voltage required by the cable (5V, i think).
At this point i'm stuck: must i buy a couple of breakbox or a cables for my Netduino Plus 1 and implement via rs232, or buy a Netduino Plus 2 and implement the communication with the winform app via Ethernet? It is possible a two way communication? I've tried to use Socket on ND+1, but in that case, i obtained a crash when i tried to create an instance of the output ports (4) for the stepper motor. Viceversa, if the output ports are already created, i cannot create a Socket.
>>here, don't waste your money! I have been using FTDI chips in c# for years. They have an unmanaged API for years, but now they have a c# wrapper api as well. FTDI now offers up to 4 ports that can be mapped into 4 VCP, or USB based individually.(FT4232) you can also get a two port device as well, the FT2232. A partner company DLPdesigns makes the pcb dev boards that can be mounted on breadboard. they are very easy to set up and use. since there is a pretty large user base, many good examples out there for use. so,
so offerings by dlp designs;
two port model;
http://www.dlpdesign...usb/2232h.shtml
4 port model;
see FTDI page on chip
http://www.ftdichip....ICs/FT4232H.htm
see evaluation board offered;
http://www.ftdichip....Mini_Module.pdf
So, going forward, well these items work in your application?
cheers
Ron
Santa Clara, CA
if you want to
Plus i think that with the COM1/COM2 solution i have to make 2 usb ports busy, plus a thord for the webcam. Too much cables and also i don't know if the communication is enough robust.