I'm writing a program where the user enters a product code to perform some operation. This product code is given through a digital line to my vi where it takes the digital data and has to let a particular loop know what to do (via message queues) My question is the data coming in will probably be a binary, the data i need to get is probably a string (product 1, product 2 etc) how does labview know that the binary data coming in through that digital line corresponds to which of the product selection strings?
Do i have to specify that somewhere? I've attached an image of the vi I'm creating to accept the digital data and stick it in a queue to let one of the other loops know what to run.
I would attach the vi but there's a ton of dependencies.
Thanks and sorry for the long message,
I think only you will be able to answer your own question because you have designed whatever this communication method is.
You talk about reading a digital line, but your VI is collecting 1 sample of data from an analog input. Where are you getting this binary data from? How does an analog voltage (I'm assuming it is a voltage since that is the most common type of analog output) related to a product code?
So the digital line sends out binary codes, 00, 01,10,11 and these correspond to the product codes, this is my question. How do I relate the binary output from the digital line to the string I need to match it with?
Or is this whole thing completely wrong and there's a correct way to get data from the digital line and send it to a message queue to pass on?
I'm having trouble understanding how to get the user selected product code which is a string from the daqmx!
I might be making this more complicated/confusing than necessary, please bear with me while I try to understand the complexities of labview functions haha
The problem is your are not reading a string of digital bits. You are doing a 1 sample read so you are only getting a 0 or a 1. You need to read multiple samples.
But do do that you need to know more about your data stream.
When does the data start and when does it stop? How long does it last? How long does a bit 0 or 1 last?
You need to read multiple digital samples that start before the data starts and ends after the data stops. You need to know the length of time for a binary bit. You need to read at a sample rate that is faster than the length of time for a bit so that you don't miss a 0 or 1. Then you need to process the entire digital waveform to break it into 0's and 1's. Of course if you have a stream at 100 Hz, and read 1 kHz, you'll have about 10 0's in a row representing a 0 bit, or 10 1's in a row representing a 1 bit.
It sounds like you are trying to reinvent a serial data stream. What are you communicating with? Is it serial RS-232 data? I think what you are trying to do is more complicated than you think it is.