LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing

code to change the address from one serial device to another. I have to devices that I need to poll one at a time. One is addressed 0 the other1. I need to write a function that will send the serial command to the device through labview. How do I do this?Through com2 I have a wireless device attached. It currently looks at all other wireless devices with the same address, 0. I need to send a serial command to this device to change address to 1 so that it only looks at the data coming from address wireless device 1. Then in another loop will send command to return to address zero to download that data.. Can someone assist?
0 Kudos
Message 1 of 8
(3,118 Views)
code to change the address from one serial device to another. I have to devices that I need to poll one at a time. One is addressed 0 the other1. I need to write a function that will send the serial command to the device through labview. How do I do this?Without details on the wireless device, it's hard to give an exact answer. Basically, what you will need to do is use a VISA Write with Com2 as the VISA Resource Name. Determine the correct command to change address from the device's documentation. That command (properly terminated) is what you use for the VISA Write's write buffer input. By properly terminated I mean that most serial instruments require a termination character at the end of each command string you send. This tells the instrument to start processing the command. Typical characters are a carriage return or a line feed. The device's documentation should tell you what to use.

Using VISA Write to change the address and probably another write command to tell the device to download, then
use a VISA read to get the actual data.

There are a couple of shipping examples of serial communication that should help get you started and application notes and additional examples can be found here. I would also recomend debugging the cable and verifying the commands first with a program like Hyperterminal.
Message 2 of 8
(3,118 Views)
code to change the address from one serial device to another. I have to devices that I need to poll one at a time. One is addressed 0 the other1. I need to write a function that will send the serial command to the device through labview. How do I do this?OOps, I forgot to include a piece of information. The wireless devices are Maxstream tramsmit/receivers. In order to get data from two seperate devices it is ecessary to have each receiver channel selected. So, I want to stsrt the Labview program by setting the transmitter/receiver to channel 0. Later in the program I will then change to channel 1. This enables Labview to read alternately from one channel or the other. Believe it or not I have writen the rest of the program to download the data and it works but it downloads both channels at once and causes problems in parsing. If I put the channel select function (write to, read from, write to, read from, write to, read from) then all will be well. HELP!
0 Kudos
Message 3 of 8
(3,118 Views)
code to change the address from one serial device to another. I have to devices that I need to poll one at a time. One is addressed 0 the other1. I need to write a function that will send the serial command to the device through labview. How do I do this?Sorry, I need to add,that all of this works very well in Hyperterminal. By entering "+++" in hyperterminla the PC takes control of the wireless. An "OK" is returned. I then type "ATDT0/r" or "ATDT1/r" and receive an "OK" I then type "ATCN/r" to terminate control of the wireless and receive an "OK" The data from the device is displayed on the terminal window. I can inerupt by going through the same sequence "+++",....... for the other channel. Now how do I incorporate this into my Labview program as two seperate cases. I have written the rest of the program and it runs fine in Labview, I'm stuck on how to serial command the device through Labview programming. Thanks.
0 Kudos
Message 4 of 8
(3,118 Views)
code to change the address from one serial device to another. I have to devices that I need to poll one at a time. One is addressed 0 the other1. I need to write a function that will send the serial command to the device through labview. How do I do this?Lab Student -

Thank you for posting on the Discussion Forums.

It shounds like you're off to a good start on your project. Serial communicatcion is relativel easy in LabVIEW. Please check out the shipping example that ships with LabVIEW called "LabVIEW <-> Serial.vi". You can find this example by opening LabVIEW (6.1, or 7) and going to Help>>Find Examples>>Search>>keyword: Serial>>"LabVIEW <-> Serial.vi"
The example can also be found by searchig examples in older versions of LabVIEW.
This VI is the equivalent of hyperterminal. The only thing you will have to watch is the syntax for your commands. "/r" is the equivalent of a carrige return (which is an non-displaying character) in a string text box. Right click on the string text box and select " '
\' code display" in order to see non-displaying characters.

Regards,

-Erik
0 Kudos
Message 5 of 8
(3,118 Views)
code to change the address from one serial device to another. I have to devices that I need to poll one at a time. One is addressed 0 the other1. I need to write a function that will send the serial command to the device through labview. How do I do this?I would recomend using the VISA functions as I mentioned earlier. I've attached a picture that shows one approach for a single device. Basically, all it does is send the commands, does a small wait, and then reads the serial buffer until there are no more characters present. You could put the ADTO/ADT1 command inside a case structure. There are lots of ways to do serial communication and some are a lot more sophisticated than the example I've shown but a bit harder to explain. Lots of people of have posted examples to this forum (including me) so you might want to look them over as well by doing a search for serial comm. Be prepared to see a lot of postings. Serial communication is one most frequently posted questions and no two application
s are ever the same so you'll probably have to make several changes to what I posted before you finally get it to work.
0 Kudos
Message 6 of 8
(3,118 Views)
code to change the address from one serial device to another. I have to devices that I need to poll one at a time. One is addressed 0 the other1. I need to write a function that will send the serial command to the device through labview. How do I do this?I have looked at the examples but am confused as to how I keep writing serial commands after I receive the "OK" back from the port
0 Kudos
Message 7 of 8
(3,118 Views)
code to change the address from one serial device to another. I have to devices that I need to poll one at a time. One is addressed 0 the other1. I need to write a function that will send the serial command to the device through labview. How do I do this?Dennis, I didn't see where the picture was attached.
0 Kudos
Message 8 of 8
(3,118 Views)