03-30-2015 11:02 AM
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.
03-30-2015 11:13 AM
@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.
03-30-2015 11:45 AM
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?
03-30-2015 12:13 PM
Also i changed everything to u16 but it wont let me change my "instantaneous Watts" plot from u8 to u16
03-30-2015 12:47 PM
@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.
03-30-2015 12:56 PM
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
03-30-2015 12:58 PM
for 300 (decimal) 0x12C (hex) i send the high byte 0x01 then the low byte 0x44
03-30-2015 01:01 PM
@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)?
03-30-2015 01:03 PM
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.
@jonathangt923 wrote:
for 300 (decimal) 0x12C (hex) i send the high byte 0x01 then the low byte 0x44
03-30-2015 01:08 PM
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