05-21-2013 05:20 AM
Hello,
In my current LabView Project I'm using the "Queued Message Handler" design patern. The Labview program has to fetch data from multiple devices connected to serial ports. For the devices where I'm mostly convernd of their status this way works as expected and good. The data in the answer is transmitted to the rest of my program using notifications.
However I also have a testrack to where I need to send multiple commands (from different loops) and (in most cases) need the answers from the testrack in the loop that transmitted the original question.
So now my question is: How can I check the answer in the transmitting loop while the other queue's are "unaffected" (it's ok for me if they see the answer as long as the original transmitting loop still get's the data). (Hoping) to make it more clear I also attached a picture of wat I would like to have)
I hope you can help me.
Solved! Go to Solution.
05-21-2013 05:27 AM
Can you attach your VI ?
05-21-2013 05:31 AM
Well my project is already getting quite big and I prefer not to post it yet.
But since I also havn't written this part of my program yet it's also gona be a bit tricky to post.
05-21-2013 05:46 AM
How you are implementing serial parser ?
05-21-2013 05:53 AM - edited 05-21-2013 05:57 AM
For each (serial, async,...) device write a queue controlled state MC that handle the device.
The control queue handle init,setup,fetch data, get statusXY, ...,free_device and the outputs are named queues for the (standard) data stream and the additional (status) information.
The command queue data cluster not only contains the command plus parameters but also the name of the output queue for this command.
Like that the device state MC control each data request (and can for example cancel or shift a selfcal request during a measurement...)
(a good practice would be that the data is only send to existing, named queues 😉 )
05-21-2013 05:59 AM - edited 05-21-2013 06:09 AM
@Ranjeet_Singh At the moment I'm not 100% sure of my serial parser. My last attempt (using functional globals and queue's) looked something like the example attached. Although if you have better suggestions I'm open to it.
@Henrik_Volkers I missed your post in my reply. But can you explain your post a little more. Although I'm learning LabView quite fast I'm still fresh in the waters that are called LabView (and I yould like to prevent my "final" code to look something like this http://zone.ni.com/devzone/cda/pub/p/id/1735 (figure 1))
05-21-2013 06:34 AM
What is the response size from each transmitter ?
05-21-2013 06:38 AM - edited 05-21-2013 06:39 AM
I guess you mean by this a short description om my protocol so here it is:
Byte | |||||||
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Start | DSTAddr | Command/response | ProbeData | DataHI | DataLO | Checksum | End |
0x02 (STX) | 0x00-0x06 cardNo | 0x0.. - 0x3.. = ProbeNo | 0x00-0xFF | 0x00-0xFF | LRC (bytes 1-5) | 0x03(ETX) | |
0xFF broadcast (To all cards) | 0x..0 - 0x..3 = ChannelNo | ||||||
broadcast only allowed from master | 0xFF if not used | ||||||
In case of broadcast no answer | |||||||
So in basic it's a byte-orriented protocol that is 8 bytes long.
05-21-2013 07:00 AM - edited 05-21-2013 07:00 AM
I dont know your application but I did something. Try to modify this if this is OK.
I hope this is what you are looking for.
05-21-2013 07:22 AM
@Ranjeet_Singh I modified your file a bit so you can see the result.
My testsystem returns 8 bytes to every 8 byte command. However my problem is not the serial parser but more how I can distribute the commands transmitted by each loop back to the respective loops.
I'm guessing the answer is somewhere in the post from Henrik_Volkers but I'm having problems understanding his post. (not the English part, but the labview part)
However while keep thinking over his post I'm wondering if it would be a "good design" to send with the command (to the serial parser) also a reference to the queue used in the transmitted loop.