12-19-2011 05:25 AM
Hi,
The query is related to getting data into the DAQ card and then to PC using LABVIEW.
Basically, I have a number of sensors connected to a PIC Micro.
I can get the DAQ to send a request to the PIC via 6211 Digital output pins
And I can programme the PIC to output data based on the Request.
The output of the PIC can be:
1. Pulse-width.
2. Serial data.
3. Or, if desparate, Analogue via a DAC.
The question;
Can a Labview code author get a USB-6211 to read (5V RS-232 style) serial under LABVIEW control ? (is there something like a 'SerialIn' command in LABVIEW?).
I see the 6211+LABVIEW can do pulse width measurements, but I don't see what the maximum pulsewidth is from the DAQ data sheet. Any ideas?
I'd be really grateful if you can enlighten me.
(Please note, I can't change the PIC+sensor arrangement, that's fixed.)
Thanks.
W.Miller.
12-20-2011 03:44 AM
If you are fine with serial data, why not connect to a serial port on your PC (using something like a max232 or 233 chip to convert the TTL to serial levels).
You can use the VISA serial API to control the serial comms from LabVIEW.
12-20-2011 01:51 PM
@Stephen C wrote:
If you are fine with serial data, why not connect to a serial port on your PC (using something like a max232 or 233 chip to convert the TTL to serial levels).
Also my recommendation.
If it's a connectivity issue, I've had real good luck with SiLabs CP2102 USB-UARTs. Can get a little finicky with Win7, but the newer driver versions improved performance with that.
12-22-2011 03:20 AM
Hi, many thanks.
Sadly I can't do that, the digital data has to go into the DAQ to be hoovered up along with a pile of analogue data with a single cable to PC+Labview.
I agree a separate digital serial line to PC would be the best option but I haven't that option available to me.
Basically, I have a Box + USB6211 + PIC with a bucket-load of connectors... and it must use a single cable to PC.
So, the 6211 DAQ must pick up the data from the PIC somehow.
On the 6211 DAQ card I have one spare Analogue channel and one spare digital channel.
I was reluctant to convert the data to analogue using a DAC as that is yet another little thing that can alter the numbers.
Therefore my preferred option was to transfer PIC ---> DAQ digitally somehow.
If LAbview can't read serial style data then my only other option appears to be a Pulse-Width output from PIC and DAQ+Labview reads pulse-width?
I couldn't find any info on the NI website showing the Labview command sub-set available when used with particular DAQ cards, but I assume Labview+6211 can do pulse width measurements to a good degree of accuracy? Is that correct?
Nor could I find the maximum readable pulse-width that the DAQ+Labview could accept before timeout/error.
Any ideas? I assume it is clock/sample/variable-size related?
12-22-2011 05:03 AM - edited 12-22-2011 05:06 AM
Since the serial data is just a series of highs and lows, you can theorectically read it in on any digital line, providing that you ensure it samples all of the required bits - this may be tricky in itself!
You would also have to write the code to extract the information from the binary data you have received, including removing start/stop/parity bits.
I have had a search around, and I can find no example code of serial reading through DAQ devices, although there is an example of somebody sending a byte of serial data from a PCIe-6536 here: http://forums.ni.com/t5/Digital-I-O/Writing-a-digital-waveform-to-a-single-line-with-DAQmx-and-the/m...
Another thing to consider: with only 1 digital line, how could you let the pic know that it had sent garbage data.If you missed a start bit for example, and ended up out of sync with the comms, you would need a way to request for the pic to resend the data.
Its not a task I would envy, which is why I always opt for a max232 interface.
I will see if I can find the specs for the PWM measurements for reference. I will post back with them when I track them down.
Best of luck with the project.
Steve
12-22-2011 11:52 AM
Stuff a USB hub in the fixture and use one of the USB-UARTs I mentioned earlier? Then you'll just have the one USB input on the fixture.
Startech makes an industrial USB hub that I've really taken a liking to. Reasonably priced for what they do (about $50), can take 7-24V DC on the terminal block, and have mounting ears right on them. Can also DIN-rail mount the hub if you so desire.
I bought one personally so I can hook it up to a truck or motorcycle battery and charge phone/GPS/helmetcam. 😛
http://www.tigerdirect.com/applications/SearchTools/item-details.asp?EdpNo=4209712
12-26-2011 03:31 PM
Thanks for reply and link.
That's an interesting option Snowmule. I shall cogitate.
As far as letting PIC know about good/bad data...
PIC can read a good/bad pulse from DAQ and measure timing. XmS = good , YmS = bad.
If I can't fit hub into box I'll abandon serial and revert back to PlanB where DAQ requests a pulse from PIC and DAQ measures pulse-width.
Any idea on maximum pulse length before error or timeout with LABVIEW + DAQ?
I can't find this info in Data Sheet.