ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Instrument Control (GPIB, Serial, VISA, IVI)

取消
显示结果 
搜索替代 
您的意思是: 

Send this message frame

已解决!
转到解答

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.

下载全部
0 项奖励
1 条消息(共 12 条)
4,138 次查看

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 项奖励
2 条消息(共 12 条)
4,132 次查看

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 项奖励
3 条消息(共 12 条)
4,115 次查看
解答
已被主题作者 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 项奖励
4 条消息(共 12 条)
4,112 次查看

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 项奖励
5 条消息(共 12 条)
4,108 次查看

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 项奖励
6 条消息(共 12 条)
4,100 次查看

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 项奖励
7 条消息(共 12 条)
4,096 次查看

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 项奖励
8 条消息(共 12 条)
4,093 次查看

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 项奖励
9 条消息(共 12 条)
4,085 次查看

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 项奖励
10 条消息(共 12 条)
4,081 次查看