LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial write , read and graph help !

Hi All,

 

 

The more I think I got it close, the far it seems to get away from me. So, this is what I should be able to do. ( Feeling a retard )

 

1. WRITE    -----    Write 5 to 200 bytes of hex code including ascii ESC first byte and lascii CR last byte with 2 bytes lsb checksum   ( obtained by adding all the previous byte including 1B ) converted to ascii ( 1B and 0D) .  Example for a 5 byte write command  -    1B 22 33 44 0D  . So, put outgoing data in array and send it out through serial port ?

 

2. READ  ---    Incoming Hex Serial  Data going to array ( whose length to be determined by checking  0x0D  ). 

 

3 .Convert the hex data in arrays to ASCII .

 

4. Graph the hex data .

 

 

Any insights? Any chances of example VI files for reference? 

 

thanks

sasha

0 Kudos
Message 1 of 8
(3,023 Views)

Show us what you've done, where you are "stuck", and we'll provide help.  If we do your homework for you, then you need to provide us your instructor's e-mail address so we can get the appropriate credit for our work.

 

Bob Schor

0 Kudos
Message 2 of 8
(3,012 Views)

There is the Simple Serial Write Read example.  That should get you started with talking over a serial port with VISA.

 

It seems like you have an array of bytes that you need to send.  You just use the Byte Array To String to convert directly into a string and send it.  For reading, there is the String To Byte Array that you can use to start parsing your data.

 

Show us what you have so far.  Be sure to include any sample data you may have and expected results.  Things get really confusing when stating ASCII and Hex since people can interpret that in 10 different ways.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 8
(3,010 Views)

As hard  as it is to say - you are right. It is my college work. All I am able to do is follow example, open ports send ascii commands and receive values in arrays. What I cannot do from that example is break that hex stream into bytes starting with SOH and ending with CR and ignore those common ones and save rest to plot data. 

0 Kudos
Message 4 of 8
(2,993 Views)
What exactly are you doing? As mentioned, you would use String to Byte Array and then just use the Index Array to get whatever bytes you do or don't want. With the configure serial port, you enable the termination character and set it to a carriage return. Don't use the bytes at serial port. Just specify some high byte count. Because serial communication is asynchronous, your first read may be incomplete so you would just discard it.
Message 5 of 8
(2,988 Views)

Duplicate Post

 

Please don't start a new thread with the same question.  Especially when you were already getting help in the other thread.

 

Continue in that first thread.

0 Kudos
Message 6 of 8
(2,982 Views)

Yes, I agree. It was stupid to post similar one. Desperateness blindfolds.


@RavensFan wrote:

Duplicate Post

 

Please don't start a new thread with the same question.  Especially when you were already getting help in the other thread.

 

Continue in that first thread.


 

0 Kudos
Message 7 of 8
(2,970 Views)

I recommend changing to an array of bytes and use Array Subset to just get the data.  From there, it is just getting the data that you want.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 8
(2,952 Views)