Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Send this message frame

Solved!
Go to solution

Hello, 

I wanna send this message format (attached jpg) by using serial port. So i made the attached vi, but I faced those problems

how to send the FCS?
how to make it send the message format every 1 second? 

And I need to know is this work on right track or not?. 

 

thanks.

Download All
0 Kudos
Message 1 of 12
(3,981 Views)

marvel...,

 

Several things need to be considered.

 

First, since you are transmitting binary data and the format specifies how to determine the length of a message, you need to disable termination characters in the intialization VI.

 

To send the data once per second enclose the VISA Writes in a while loop with a 1000 ms Wait.  As long as your messages do not approach 1000 characters you should be OK on timing.

 

I would concatentate all the characters of the message, except the SOP, to do the FCS.  Then prepend the SOP and append the FCS byte. Use one Write to send the whole string.

 

Lynn

0 Kudos
Message 2 of 12
(3,975 Views)

really, thanks very much.
but can you explain what are you meant by

"First, since you are transmitting binary data and the format specifies how to determine the length of a message, you need to disable termination characters in the intialization
VI."

and 

"I would concatentate all the characters of the message, except the SOP, to do the FCS.  Then prepend the SOP and append the FCS byte. Use one Write to send the whole string."

 

then, is my work on right track?
thanks. 

0 Kudos
Message 3 of 12
(3,958 Views)
Solution
Accepted by marvel of future

Here is a quick modification to your VI showing how to concatenate the strings and use the while loopand Wait functions to repeat once per second.

 

Some of these things are very basic to LabVIEW.  If you have not done so, take a little time to work through the on-line tutorials.

 

Lynn

 

0 Kudos
Message 4 of 12
(3,955 Views)

really, very thanks to you. I'll do my best to learn from your modifications.
and if you can provide me by good on-line tutorials, it'll be nice. 

thanks very much for you.

 

0 Kudos
Message 5 of 12
(3,951 Views)

sorry, I have a questions on the modifications.

 

what are you meant by the following:

"set loop to run once per second. "

"Replace with subVI to calculate FCS"

"Disable Termination char >>>"

 

sorry for disturbing you.

 

thanks.

0 Kudos
Message 6 of 12
(3,943 Views)

Look at the on-line tutorials here.

 

Turn on the context help while programming.  The little box will tell you a lot about the functions and VIs in your program or the palettes.

 

The function above the "set loop to run once per second" note is Wait (ms).  It does not end until the number of milliseconds wired to its input have elapsed.

 

"Replace with subVI ... FCS."  In your data format document it tells you how to calculate the FCS.  It requires a string containing the CMD, LEN, and data bytes. Its output is the FCS byte.  You can write that.  Then remove the sequence structure and wire your subVI in it place.

 

"Disable Termination char."  The >>> just point to the False boolean constant I wired to the input on the VISA Configure Serial Port.vi.  The Context help does not show that input except as a little stub of a boolean wire, but the detailed help describes it.

 

These things will be more clear after you have worked through the tutorials.

 

Lynn

0 Kudos
Message 7 of 12
(3,939 Views)

thanks very much.

 

sorry, i don't get what are you meant by 

Replace with subVI ... FCS."  In your data format document it tells you how to calculate the FCS.  It requires a string containing the CMD, LEN, and data bytes. Its output is the FCS byte.  You can write that.  Then remove the sequence structure and wire your subVI in it place

 

In my data format document, he told me that it's 

"This field is computed as an XOR of all the bytes in the
message starting with CMD and through the last byte of data. The receiver
XORs all the received data bytes as indicated above and then XORs the received
FCS field. If the sum is not equal to zero, the received packet is in error"

 

thanks.

 

 

0 Kudos
Message 8 of 12
(3,936 Views)

If you do not understand the specifications for your communications protocol, how do you expect to develop a program to implement that protocol?

 

People who volunteer our time on the Forum do so to help people learn how to use LabVIEW.  We have other jobs and do not have the time to do your work for you.  If you cannot do it yourself and wish to hire someone, post your job on the Job Openings Board.

 

I showed you how to get "all the bytes in the
message starting with CMD and through the last byte of data."

 

XOR is a basic logical operation for which LabVIEW has a primitive function in the Boolean palette.

 

Lynn

0 Kudos
Message 9 of 12
(3,928 Views)

sorry for disturbing you and i appreciate your time but the problem was about somthing wrong in the modification but i have solved it. 

now, you can see it and told me your opinion if you don't mind.

0 Kudos
Message 10 of 12
(3,924 Views)