LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Real Time Graphing from Com Port Data

Right click on the indicator on the block diagram or front panel and select Representation.  Make the proper selection from there (I16, I32, U16, U32).  But make sure you change the data type for everything in that node, or have an understanding about how LabView coerces between datatypes.



Bruce K

Not as smart as many other peepz on here....
0 Kudos
Message 21 of 39
(869 Views)

@jonathangt923 wrote:

I just realized that I can only graph numbers up to 255 (end of ascii table).  How do i resolve this so i can graph values larger than this? Up to around 2000.


You need to think about the data you are sending and receiving.  If your controller is only sending a single byte, then 0 to 255 is all you can send.  If you need a higher number, you need to send more bytes.  If you have your controller send 2 bytes, then your LabVIEW code needs to read the two bytes and convert it into a U16.

 

Personally, I would change the microcontroller to send the ASCII characters that represent your data ("251") followed by a Carriage Return.  You can then use the termination character (the Carriage Return) to tell the VISA Read when the message is complete and you can then just do a simple Decimal String To Number to get your value.


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 22 of 39
(866 Views)

Yes it only sends as a byte.  I am running a test were i send 300 ( 100101100) in 2 bytes.  I send the high byte 1 then the termination character then the low byte 44 then the termination character.  Do i need to play with the read count at all?

0 Kudos
Message 23 of 39
(858 Views)

Also i changed everything to u16 but it wont let me change my "instantaneous Watts" plot from u8 to u16

0 Kudos
Message 24 of 39
(851 Views)

@jonathangt923 wrote:

Yes it only sends as a byte.  I am running a test were i send 300 ( 100101100) in 2 bytes.  I send the high byte 1 then the termination character then the low byte 44 then the termination character.  Do i need to play with the read count at all?


Wait a minute!  You are using the termination character with binary data?  That is NOT a good idea.  What happens if your data just happened to be the termination character?  Weird things can happen.

 

Change from sending binary data to ASCII data with a termination character.  Things will be a lot simpler for you from there.  That would require changing the microcontroller code.


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 25 of 39
(844 Views)

I am sending in hex with a termination character.  Sorry, I was just dealing with binary to make sure i was sending the lower and upper byte correctly, but everything is being sent in hex followed by a termination character

0 Kudos
Message 26 of 39
(839 Views)

for 300 (decimal) 0x12C (hex)  i send the high byte 0x01 then the low byte 0x44

0 Kudos
Message 27 of 39
(835 Views)

@jonathangt923 wrote:

I am sending in hex with a termination character.  Sorry, I was just dealing with binary to make sure i was sending the lower and upper byte correctly, but everything is being sent in hex followed by a termination character


What EXACTLY do you mean by that?  A value of 300 is being send as the ASCII string "12C" (which would be 3 characters) or "012C" (which would be 4 characters)?  Or is it being send in binary format (often called hex, 2 characters)?


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 28 of 39
(834 Views)

@jonathangt923 wrote:

for 300 (decimal) 0x12C (hex)  i send the high byte 0x01 then the low byte 0x44


That is sending the data as binary.  It you are using a termination character, stop it.  Why?  Try sending 265.  That will give you 0x010A, making your second byte the same as the default termination character.  Change to sending the ASCII representation of your number.


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 29 of 39
(830 Views)

300 in decimal  is 12C in hex and 100101100 in binary.  I created the upper byte by shifting 100101100 >> 8 bits to get 00000001 aka hex 0x01.  I took the lower byte & with 0xFF to get 00101100 aka hex 0x2C, sorry i said 44, that is the decimal representation of 2C. Then i send the upper byte 0x01 then the termination character then 0x2C then the termination character

0 Kudos
Message 30 of 39
(825 Views)