LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Communication with micro controller

hi,

I am trying to serially communicate with a micro controller. One of the command that the micro controller response to is "version". When i write the command "version" in hyperterminal I get a response from the chip "v1.0....". How can I used/setup labview to mimic what hyperterminal does? When I setup labview and type "version", I get no response. Please help.
0 Kudos
Message 1 of 31
(2,596 Views)
If you're using LV 7.0 or later (don't know if this example is present in LV 6.0) try using the following example code.
On the Menu Bar goto Help >> Find Examples ..., switch to the Search tab and type in "serial"
Try loading the example "Labview <-> Serial.vi"
Select the baud rate & COM port.
Then transmit a string like "version" and see if you receive a reply.

Good luck
0 Kudos
Message 2 of 31
(2,572 Views)
Try appending a carriage return of line feed to the end of your write string. Hyperterminal does this automatically but you have to add this yourself when you write your own program.
0 Kudos
Message 3 of 31
(2,569 Views)
I followed the example and still no communication with the micro controller.
How can I verify/insert a carriage return to simulate the hyperterminal?
Please help.
0 Kudos
Message 4 of 31
(2,537 Views)
Take the NI example and use Concatenate Strings to append a CR to the write string.
See attached example.
0 Kudos
Message 5 of 31
(2,531 Views)
There's a couple of ways. On the string control that you're using to enter the command, right click and select '\' Codes Display. Then you can add a \n (line feed) or \r (carriage return) to the end of your command. You can also do this if you've got a string constant on the diagram. Another way is to use Concantanate to String on the diagram. Wire your command to the first input and wire the appropriate constant from the string palette to the second input. The output is wired to VISA Write. Another way is to set the VISA Property Node to append a character with each write. Open VISA Configure Serial Port to see the VISA Property Node. Add another write property of Serial Settings:Serial End Mode for Writes. Right click on it and create a constant for that and select TermChar. To the termianation character input, wire a x0A (LF) or x0D (CR).
0 Kudos
Message 6 of 31
(2,529 Views)
Hi again,

Thanks for your help. When I type my command "version\n\r", I get a reply that has some garabage values and some of what I am looking for. What am I doing wrong?
0 Kudos
Message 7 of 31
(2,522 Views)
I found out that my serial cable has pin 2 and pin 3 cross. The cable works with hyperterminal.
0 Kudos
Message 8 of 31
(2,507 Views)
One thing to try is to flush the serial receive buffer before you send the command. It's possible that the garbage you're seeing is something left over from a previous command or when the micro boots up. The functions is on the Instrument I/O>VISA>VISA Advanced>Interface Specific>VISA Flush I/O Buffer.
0 Kudos
Message 9 of 31
(2,503 Views)
Sorry. No luck....
0 Kudos
Message 10 of 31
(2,499 Views)