02-28-2013 10:12 PM
The application which we are developing is a direction sensing robot. we are giving directions for moving the robot by detecting arrow symbol drawn on a paper and accordingly we are sensing left (3), right (2), up (1) and down (4) (fwd and rev actually) directions. once we run the VI the image processing algorithm will work and detect the arrow direction and accordingly produce 1,2, 3 or 4 as output (work done!). The problem we are facing is - once the first direction is sensed, the algorithm cannot sense the next direction until we re-run the application (stop the VI, and then run it). The microcontroller we are intending to use after this software stage is PIC controller, and the VI needs to send 1,2,3 or 4 to PIC when the direction sign changes at input side. So is there any mean by which we can make this program to produce successive relevent outputs as direction sign at input (webcam) changes until we stop the program? And can visa usb be more suitabel as compare to visa serial?
02-28-2013 10:24 PM - edited 02-28-2013 10:27 PM
You have a while loop, of course it will send a command every time the while loop iterates if that is what you programmed it to do.
It seems you haven't fully thought out your application yet. Have you drawn a flow chart to show how the program is supposed to run? It also seems like you haven't established any kind of timing mechanism for your VI. Do you want it to pump out a given command as fast as it possibly can? At a slower rate? Only for a given number of times before a decision determines whether to continue or do something else?
Once you have a flow chart, then you can formulate a state machine architecture to allow certain actions to happen in the needed order.
As for USB vs. Serial. I've never tried USB programming, but have done a lot of serial. USB is a lot more complicated.
02-28-2013 10:38 PM
thanx for replying..refering to the VI which you have sent later, when we run it and give various input commands, it's output is not changing as we change input.
02-28-2013 10:42 PM
Post your VI so we can see what is wrong with it. Otherwise all we can do is guess.
02-28-2013 10:43 PM
in attachment we have attached the solution suggested by Mr.R. Singh, which is the modification of the code we have developed earlier. we are facing the problem that output is not changing as input changes. i.e. refering to VI, if you supply up,dwn,left, right command, they are not affecting output. Thanx.
02-28-2013 10:47 PM
What you posted looks pretty straight forward. It is going to send a character every time you press one of the buttons.
I would suspect your code that you have running on your motor controller that is receiving the serial message.
03-01-2013 12:36 AM
refering to the last VI, when we run this VI, it takes input only once and then the pause button on the top of the VI becomes activated. (right now we are not focusing on PIC, it was just suggested so that you can understand the objective of our project.) we want the output to change according to input we provide to it, without stopping the VI, so is thaere any provision to deactivate the pause? (so previously we have used word runtime, which is to indicate allow output to change as input changes while VI is running.).
03-01-2013 08:47 AM
That example has a breakpoint. See the red dot? You can right click on it to clear it.
Note that the example does not do what your topic says. It does not continuously transmit. It sends one character with one click of a Boolean. It is also a poor example of an event structure but that is probably not relevant to the issue you are having.