01-27-2014 05:14 PM
Hi,
I'm experiencing an issue upon startup with unexpectedly high sample values being read serially.
The data is being fed from a PIC (18F2550) 10-bit ADC sampled at 1kHz and it is sending the samples out through the UART protocol (19,200 baud rate). We expect values between 0-1023 to be coming from the UART. When these high values occur (up to 2^16-1), a little wiggle on the potentiometer ADC fixes this issue and the data plots as expected.
My main.vi illustrates my main applications initial flow, it is preconfigured through the Serial Configure block, it is just not shown there.
The serialreadtointeger.vi also expects 2 bytes at the com port. High byte has 6 MSb's equal to 0 with the last two LSb's being equal to the MSb's of the data sample with the remaining low byte containing the 8 LSb's of the sample adding up to 10 bits.
This youtube video we made shows the issue in more context: http://www.youtube.com/watch?v=2NZDPYPlSZI
Are the values being concatenated from the previous application's run or is something else happening?
01-27-2014 06:08 PM
01-27-2014 09:16 PM - edited 01-27-2014 09:35 PM
Alright, that's fair. The values coming in agree with what we are receiving on RealTerm and Putty, so I'm confused why the values would correct (stay within the desired range of 0 to 1023) once we toggled the potentionemeter [refer to youtube video]?
Thanks for your help by the way.
01-28-2014 07:07 AM
@afdasfdasfadsfdafadfdsf3 wrote:
Alright, that's fair. The values coming in agree with what we are receiving on RealTerm and Putty, so I'm confused why the values would correct (stay within the desired range of 0 to 1023) once we toggled the potentionemeter [refer to youtube video]?
That is sounding like you have a bug in the pic code.
To me, this looks very much like you data is getting out of sync. You really should add something (a sync word, termination character, and/or checksum) to make sure you are getting the data in the proper format.