LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

16 bit receive over rs 232

Hello All,

 

I am a beginner in Labview and need some assistance on the below:

 

I want to create an interactive console application with Labview to communicate over RS 232. The GUI should allow me to

 

1. Send some specific commands over RS 232. (This I guess I will be able to do if I get a base application).

 

2. Receive 16 bit data over RS 232 and log it to a file. (This I guess will be tricky as RS 232 is 8 bit communication standard and the application like windows Hyperterminal will interpret 16 bit data as 2 8 bit ascii characters, which I dont want)

 

Let me know any thoughts on how to go ahead.,

 

Thanks so much,

Nagaraj Hegde

0 Kudos
Message 1 of 31
(3,552 Views)

go to the help in the toolbar, select Search For Labview Help. Then do a search for Unflatten From String Function. Look at the examples for this function. Remember to set the correct endian format (Google endian if you do not know what it is).

Post again if you need more help. In Labview you can do this in many ways. Some prefer to just use the type cast function.



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 2 of 31
(3,542 Views)

Hello Coq,

 

Thanks for your reply.,

 

I got this example Basic Serial Write and Read.vi in the example finder but when I tried executing, I got the error message as attached. Can you kindly help me out by guiding me how to resolve that. Where can I get the VISA? I am evaluating Labview and don't have any other drivers with me,.

 

Thanks again,

 

-Nagaraj Hegde

0 Kudos
Message 3 of 31
(3,525 Views)

My guess is that you do not have any VISA driver installed. You will find the VISA driver here for for download http://sine.ni.com/psp/app/doc/p/id/psp-411



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 4 of 31
(3,514 Views)

Hello Rouge,

 

I downloaded the Visa driver from the link you provided but now getting the error as attached., Kindly let me know if you have any idea about this.,

 

Thanks for your help.,

 

- Nagaraj Hegde

 

 

0 Kudos
Message 5 of 31
(3,459 Views)

Hello Rouge,

 

I think I got the solution for this, the installer had got saved as some other name.,

 

Thanks and best regards,

Nagaraj Hegde

0 Kudos
Message 6 of 31
(3,451 Views)

Hello Rouge,

 

Now I have got the drivers installed and able to run the Basic Serial Write and Read.vi. I need a help at this point., Can you plz tell me how to look at the source blocks of these examples? I need to modify them to suit my requirement., Basiaclly I want to read the incoming data from the serial port as 16 bit data., The operations you suggested initially ll help I believe, but to do that I need to alter the source blocks., Let me know if you have any hint how to do that.,

 

- Nagaraj Hegde

0 Kudos
Message 7 of 31
(3,425 Views)

I don't understand what you mean by "source block".

 

Serial data generally consists of bytes that have 8 data bits.  Sometimes they might be 7 bit data.  (5 and 6 bit are also possible, but not very common.)

 

If you have a device sending "16 bit" data, it is sending two 8-bit bytes.  You need to read two bytes, then use the numeric conversion functions and data manipulation functions to do things like Join the two 8-bit bytes into a single 16-bit word.

Message 8 of 31
(3,423 Views)

@Ravens Fan wrote:

If you have a device sending "16 bit" data, it is sending two 8-bit bytes.  You need to read two bytes, then use the numeric conversion functions and data manipulation functions to do things like Join the two 8-bit bytes into a single 16-bit word.


Ravens Fan points you in the right direction.  The Join Numbers function will form a 16-bit word from two 8-bit bytes.  However, you need to know which byte is the most significant (big endian or little endian).  If you don't put the bytes in the correct order, you will get the wrong 16-bit word.  Your endpoint device manual should specify the format it is using.

- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 31
(3,415 Views)

Hello,

 

Thanks for the replies.,

 

My device sends Lower byte first : for example : if I send 0x5658 what I will recieve in the console is XV (ascii of 0x58 is X and 0x56 is V). I am able to make changes to the basic serial write and read vi to log the data in a file but I want to log as 0x5658.,

 

Can you kindly elaborate on your suggestions ("which numeric conversion and data manipulation functions and how to use") as I am new to labview?

 

Thanks for your help again;

 

- Nagaraj Hegde

0 Kudos
Message 10 of 31
(3,378 Views)