LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

New to labview - doing a serious project



JoeLabView wrote:

I just read this thread and I must say I'm a bit confused..

Are you still getting errors during your serial transfer?  Are your settings correct?  2400 seems a bit slow.  I would have expected (at least) 9600.  Was 2400 specified in the PIC's specs?  I may have missed which specific PIC you are using, which part no is it?

If you are still having issues with serial communication, then that should be resolved before moving on the the array..  😉

R

 




This is the first time me and my uni has used serial communication using LabVIEW so im not too sure what i should be expectig in the "read string" and "bytes read" using the  BASIC READ AND WRITE EXAMPLE . Their was'nt any particular reson for 2400bsp so yes I change it to 9600 noticing a increase in the data quality.... But its still not perfect. For example if the channels voltage is in the middle of 0 and 5V's then the serial value would show up unstable between 0.98 and 2V's ( 38 to 148 BCD).
PIC16F887 .
I think I worked out which array VI to use to extract a element...called INDEX ARRAY.VI.
Which is great.
 
 
 
 
Shawn.
...:::Cheers:::....
0 Kudos
Message 21 of 46
(1,567 Views)
Yes the baud rate that gives the most accurate results is 115200, but halfs the value range?? so if the channel is 0V then it shows up 128BCD.
If 5 then it shows up 255BCD??
I think this looks like a baud rate problem.
The data sheet of PIC16F887 shows that the error % for that rate is 2.12% which is highest compared with the others..
 
The best result I get is proberbly with 19200 and 9600 with full data range .... which as i mentioned last message is not stable when voltage is more than 0 and less than 5V.
 
 
...:::Cheers:::....
0 Kudos
Message 22 of 46
(1,559 Views)

This thread is very dificult to follow. Sounds like the daq is a pic comunicating to a pc through labview over a serial port.

Voltages between 1v-2v is hard for a pic chip to to determine high or low. However, I dont see how that would effect serial comunication. Or how that would effect an analog reading from the pic chip. Could you possibly draw your layout and/or basic pic schematic/configuration. That might help us understand the problem more.

Also, If you use a for loop and connect the array to it, on the inside of the for loop you will get one item and a time from the array. Every loop will give you the next item. The iteration [ i ] will tell you what iteration you are on starting at 0. This makes coding and reading easier for big array's. if your array is only 4 bytes i wouldn't even use an array. a single string can hold 256 bytes....maybe more im not sure about labviews string size.

 

Theseas, more detailed information will help us help you faster. Have i seen you on other programming forums? Your name seems familar. Like on vbforums?

- A minute saved is a Minute earned!
0 Kudos
Message 23 of 46
(1,554 Views)
How are you sending the 10 bit data? do you break it up into two 5 bit bytes? then send lsb, msb and reassemble in labview? Or do you send a byte (8 bits) then the last 2 bits with 0's for space holders? because i dont think you can send 10 bits. your setup <baud rate> 8,n,1 is going to send 8 bits each time.
 
Purchase the USB-6008 Low-Cost Multifunction I/O and NI-DAQmx for $ 159.00. Plugs right into labview and can measure several voltages. I have several in test fixtures can measure all voltages at the same time. It will save you time and money.
- A minute saved is a Minute earned!
0 Kudos
Message 24 of 46
(1,548 Views)

Still confused....

OK..  the BAUD rate portion seems better... 9600 & 115200 are more reasonable values.

It appears that you have to work on the hardware issue(s).  Can you provide more description of the hardware?

R

0 Kudos
Message 25 of 46
(1,527 Views)


JoeLabView wrote:

Still confused....

OK..  the BAUD rate portion seems better... 9600 & 115200 are more reasonable values.

It appears that you have to work on the hardware issue(s).  Can you provide more description of the hardware?

R




Following document contains circuit diagram (using an equivelent pic), block diagram, and front panel screen shots whilst testing (using 19200)....
 
...:::Cheers:::....
0 Kudos
Message 26 of 46
(1,503 Views)
So what should the pic be sending out the serial port? Is every byte sent out from the pic the analog value, over and over again? and is it only a byte size like I was asking about before? so 0 volts sends out 0x00 (0) and max 5 volts sends out 0XFF (255)? If thats correct then you should be getting 0 for 0volts and about 127 for 2.5Volts. From you document it looks like your measurement is off by about 0.4 volts. So maybe your reference voltage is slightly off going into the pic. I've only done 5volts I/O on the pic16f84 so far and am not familar with the analog setup of the pic you are using.
 
Okay onto the labview layout that you have. First off you have write enabled on the front panel of the read/write example and im not sure what your pic should be receiving back from the pc but i doubt it is *IDN?\r\n since i think thats te default write command in the labview example. Next your only reading the first of many "bytes read" each loop to do your calculation with. Maybe you could incorporate an "average returned value" for better results. If you put the unsigned byte array into a for loop and then add each of those values together and divide by the loop amount you could get an average returned value. I dont know how many bytes are sent between labview loops but it could help a little bit.
 
Another thing i've noticed with the read write. Sometimes i would get garbage when i started to read from the serial port. Like the buffer still had bytes to read. There is a "VISA Flush I/O Buffer" and depending on the mask value you can flush out the serial port before reading.
 
Mask Values Hex Codes Description
16 0x10 Flushes and discards contents of the receive buffer (same as 64).
32 0x20 Flushes and discards contents of the transmit buffer by writing all the buffered data to the device.
64 0x40 Flushes and discards contents of the receive buffer (does not perform any I/O to the device).
128 0x80 Flushes and discards contents of the transmit buffer (does not perform any I/O to the device).
 
You could do this before you start reading, to flush out any junk on the serial port.
 
hope this helps a little.
- A minute saved is a Minute earned!
0 Kudos
Message 27 of 46
(1,493 Views)
Cheers Guys, help greatly appreciated.
 
Ok  pRoFiT  your spot on mate, what im doing. I put the VISA flush before reading.
Now I get long delays inbetween reads about 4 secs. 
What I mean is it would read....go to zero for 5 sec....then read.Continuously.
 
 
 
Why is it when I tried the 115kbps it didnt give a full range?
 
 
 
 
 
...:::Cheers:::....
0 Kudos
Message 28 of 46
(1,451 Views)
 
Another problem was with creating a time stamp for the graph... For some reason the iteration isnt giveing any value... Im assuming their is a small silly mistake somwhere.
 
 
 
 
Please refer to above .doc.
 
 
Thnks
...:::Cheers:::....
0 Kudos
Message 29 of 46
(1,448 Views)
can you show an image of that portion of code or attach what you have so far?
 
R
Message 30 of 46
(1,433 Views)