10-21-2015 11:53 PM
okay got it thanks, so i attached the screen shot of the data in hex. so as i said the voltage i am reading is a AC voltage of .2 and the ADC reading are read one bit at a time, so for example if i am reading 50 and 60 then format would be !50$, followed byt !60$, indcating start of and end of each number. so each value read has ! for start and $ for end. I dont know exactly how its coming in and displaying in labview but as you said maybe the bits are broken up. So as you said, im comparing for the ! mark but not working so im not sure if i can actallly put a ! to compare or do i have to actually format for "!" and "$"
10-22-2015 12:47 AM
10-22-2015 07:45 AM
@Dennis_Knutson wrote:
At this point, you would be better off sending the entire measured value as ASCII text. You should perhaps debug the communication with a terminal emulator such as putty before writing your own program.
Since it sounds like the OP is in full control of the microcontroller code, I second this. Changing things to be ASCII makes things A LOT simpler. I see two ways to do this:
1. Have the microcontroller do a straight conversion to the decimal value in ASCII.
2. Change your bytes into hexidecimal ASCII characters (would double the number of bytes being sent).
To make it more universal, I would go with option 1.
Regardless, I recommend ending the message with a Line Feed (0x0A) so that you can just use the termination character to stop the VISA Read and you know you go the whole message.
10-22-2015 10:05 AM
So as I said before I have the adc setup to read one reading at a Time so when a value comes in it places in a biffer from msn to lsn and also have a ! For start of day and $ for end of data on ever value so I can separate the numbers. So when labview gets the values some time of conversion is happening and I think it has to be labview side.
10-22-2015 01:04 PM
10-25-2015 12:19 PM
So if you dont mind, how should have i the microcontroller send the data and have it formated in the micro code to make it easier on the labview side
10-25-2015 12:43 PM
10-25-2015 05:20 PM
http://www.codeproject.com/Articles/473828/Arduino-Csharp-and-Serial-Interface
might help you understand what is required
Though it is about Arduino and C#, the concepts are quite relevant.
10-25-2015 09:06 PM
I finally got it to work, the baudrate was not correct from the data sheet so i hook it up to a oscope and figured it out there, so now my micro controller is sending straight ascii values and the right data. So now my code works as follows im sending sets of 512 numbers and i have a $ that insitates the begining of each 512 numbers, then between each number there is a comma, there is 8 digits between each comma, So now i need a way to find each comma and $ sign. I used the match pattern to find the $ and comma and it does but only one $ sign and comma. I need every one. Then i need to join numbers. I have attached image of the data in buffer and make code. I also found the spreadsheet string kinda useful but idk. I have attached my code and images.
10-26-2015 07:37 AM - edited 10-26-2015 07:39 AM
At the end of the 512 numbers, is there a Carriage Return or Line Feed to signal the end of the data? If not, then I would make the '$' the termination character.
Now for your number of bytes to read, you have 512 numbers*9bytes/number+1 start bytes = 4609 bytes. I would just set the number of bytes to read for the VISA Read to 4650 and let the termination character tell the VISA Read when to stop.
And finally your parsing. Use Spreadsheet String To Array.