LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Serial Data

Hi,

I have a device (EMD High voltage generator) that I am trying to communicate with. The device manual reads:

 

An input to the generator (RTS line), when held high, inhibits the generator from transmitting the network initialization message (communication is disabled). After communication has been established, the generator initiates no message transfer. The external controller must request any required information from the generator.

 

 

When a device receives a message, it must return the following acknowledgement message to the original sender: 1. 06h 2. 03h

If the sender receives no acknowledgement within 200 ms, the message is retransmitted once and, if necessary, twice; then, the sender will await further instructions from the receiver.

 

From this I assume that the generator is continouslsy sending a network initializiation message, which the external communicator (my labview code) has to pick up on and then respond with 0603. I have looked at the basic read/write sample code but I'm not sure if that is the right way to approach this (since I am trying to read continuous data that is being sent by the generator).

 

I would really appreciate a point in the right direction,

Thanks

0 Kudos
Message 1 of 27
(4,961 Views)
yes indeed you should use loop and check for any irritation whether you receive massage or not . if you know what is message length you can use it for read vi
in this case when bytes at port are in the length size read vi will be read the data
0 Kudos
Message 2 of 27
(4,951 Views)

Could you give me an example of code?

Thanks

0 Kudos
Message 3 of 27
(4,943 Views)

For example, would this edited VI work?

Also I know the message I am recieving is 8 bytes, so what should I set the readcount to?

0 Kudos
Message 4 of 27
(4,937 Views)
send your manual or at least tell us what is your device comments
this vi that you send is just labview example vi
0 Kudos
Message 5 of 27
(4,931 Views)

I am looking at pages 5 and 6.

Thanks

0 Kudos
Message 6 of 27
(4,925 Views)

@mnanda98 wrote:

For example, would this edited VI work?

Also I know the message I am recieving is 8 bytes, so what should I set the readcount to?


From the start there is a big issue with your vi. You have a 5 ms loop delay and your Write button mechanical action is set to Switch When Released. Try the following vi, you will probably get over 20 Write action triggered even if you click as fast as you can on the Write button. Now change the mechanical action to Latch When Released and see the difference.

 

Read Serial Data Issue.png

 

Ben64

0 Kudos
Message 7 of 27
(4,921 Views)

Ok, but I am trying to read the data primarily for my purposes.. Would this program work for reading data the is continuously being sent by the generator?

0 Kudos
Message 8 of 27
(4,910 Views)
I see the pdf you have to send some comment inside the device after that
device will be answer back with 06h or 03h and you have to read it good news is both are same byte and you need just read 6 byte every time
also there is 5 different comment with different byte length that you have send to receive one two massage form device
study table x example more carefully
0 Kudos
Message 9 of 27
(4,896 Views)

How do you know 6 bytes?

0 Kudos
Message 10 of 27
(4,874 Views)