05-22-2012 01:36 PM
Hello everyone, i was hoping someone could help me with my project, im trying to do an oscilloscope using labview acquiring data through USB and a pic 18f4550, but I've encountered the problem that i cant register all the data thrown by serial because there are zero values between my readings so i cant get a good signal read and my graph isnt good. Can someone please help me?
Thanks
05-22-2012 04:08 PM - edited 05-22-2012 04:09 PM
I'm sorry, but can you please explain better what the issue is? What do you mean there are "zero values between my readings"? How is the PIC sending the data? Is it sending it continously? Is it sending it as a response to a command? You said USB. Is it direct USB, or do you have a USB <--> serial interface?
Please provide more details and show us the code. Attach the VIs to this thread.
05-23-2012 07:43 PM
Hi, sorry im kind of new on this sort of thing. Yeah i mean like if im sending a DC signal of 3 V, you can see the reading is 3,3,3,3,0,0,3,0,3,0,0,0,3,3,0 or something like that, the pic is sending the data continiously and im using the USB like a serial port, i dont know if theres anything wrong with my VI logic
Thank you for any advice you can give me
05-23-2012 08:46 PM
Is there a reason you are configuring the serial port on each loop iteration, then flushing the buffer after you read you X number of bytes?
Serial port configuration should be done before the loop, and closing the port done after the loop. And there is very rarely a reason to flush the buffer unless you really want to throw away data.
Beyond that, I really don't know what you are trying to do. You talk about an oscilloscope, (which I don't see any evidence of using in your VI), but you are using a serial port. But you don't seem to be talking about serial communication. You talk about zeroes between your readings, but if you get rid of all of them, you have nothing left but 3's.
So what are you doing?
05-23-2012 09:00 PM - edited 05-23-2012 09:01 PM
It sounds like he is having trouble triggering the signal due to excessive time in the space state. Are you using a DSO or an analog scope? Based on Raven's Fan's response, you are only using the scope to measure signals manually. If this is the case, this is not a LabView issue, but a training issue with your scope. If that's the case refer to the manual on positive-edge triggering. Am I off base?
05-23-2012 09:55 PM
The signal to be read goes in through a 18f4550 PIC, goes throug its ADC and then its sent through serial to the VI, and the reason i want to eliminate the zeros its because otherwise i get peaks that start in 0 and go all the way to 3 every once in a while. Sorry about my unexpert lenguage but Im really new to this
05-23-2012 09:57 PM
MoReese yes that excessive time in space state sounds about right but i have no idea how to reduce the time so i can get a more "real-time" reading
05-23-2012 10:07 PM
I'd say your wrong. Flushing the buffer just deletes any bytes that come in immediately after you read the buffer. So they are actually newer bytes than the ones you just read, you just haven't gotten around to reading them again.
If you are using a "oscilloscope", don't they generally show you everything that comes in during a period of time? Then why would you want to discard data?
I still don't understand how your 0's, and 3's have anything to do with your O-scope. There seems to be a mismatch with what your are doing with your hardware, how you are transmitting the data to LabVIEW, and then what you are trying to do with the data once you get it in.
You still haven't answered my question about if you eliminate your 0's, all you are left with is 3's. So isn't that meaningless data?
What do your 0's and 3's mean at the time you are collecting them? What signals are your trying to measure? Why do you want to eliminate all of the 0's?
Show us a picture of the signal you are dealing with, and some sort of flowchart/schematic of what your entire process is supposed to be doing.
05-23-2012 10:18 PM - edited 05-23-2012 10:19 PM
@Axlldb wrote:
Hello ravens fan, hahaha quite frankly im now a lot more confused that when i asked but ok ill try to explain. I flush the buffer because being an oscilloscope the only useful data is the new one or am i wrong?The signal to be read goes in through a 18f4550 PIC, goes throug its ADC and then its sent through serial to the VI, and the reason i want to eliminate the zeros its because otherwise i get peaks that start in 0 and go all the way to 3 every once in a while. Sorry about my unexpert lenguage but Im really new to this
This doesn't make any sense. Why do you want to eliminate all the LL bits? the serial data is supposed to go from 0-3, 3-0. It's not clear on what your intention is or what the data coming from your PIC is supposed to be or what it looks like. What is your serial communications format (8,N,1 etc.)? Let's start there.
Can you not control the transmission rate from your PIC? If so, you can cycle a transmission, thereby making your data capture easier, but based on your previous responses, you should not read anything.