LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial port and USB card 6229

Hello to everyone!

I'd like to help me solve my problem, because I have to finish my project as soon as possible. I have:

  • windows XP
  • LabVIEW 2010
  • USB card 6229
  • and a serial port( from ECU) that inputs data like EGT,RPM and Throttle control

My data acruiring rate is 50 hz with 25 samples.

I would like to make my code work using NI DAQmx and VISA or doing two different loops (one with USB data and another from serial port) and then synchronize them. Below is the VI that I have made, but it does not work when I change the level of throttle (serial data) from the special control device.

Thank you in advance

0 Kudos
Message 1 of 12
(3,401 Views)

Can you describe what doesn't work.  Are you saying that you change your device, and you expect the serial readings to change, but that you are not getting new values from the serial device?

-------
Mark Ramsdale
-------
0 Kudos
Message 2 of 12
(3,397 Views)

whoops, duplicate.

-------
Mark Ramsdale
-------
0 Kudos
Message 3 of 12
(3,397 Views)

exactly!when I increase or decrease the level of throttle it's the same...if I put out of the loop the DAQ Assistant, then the throttle changes as it has to, but the data that the USB send as inputs are the same every 50 samples

0 Kudos
Message 4 of 12
(3,392 Views)

HI,

 

Can you read the instrument directly from MAX and see a difference in the readings when the throttle is changed?   If you can verify this, then focus on the code.

 

-------
Mark Ramsdale
-------
0 Kudos
Message 5 of 12
(3,376 Views)

No I can read the instrument only via ECU(that means VISA)...Do you mean something else?

0 Kudos
Message 6 of 12
(3,373 Views)

I wanted to see if you could independently verify the instrument is replying correctly when the throttle is changed.  MAX can be used like a hyperterminal, so you can read over and over again in max to see what is being sent by the instrument.    ( or just use a hyperterminal program)

 

The example code seems to say that the instrument is constantly sending out 18 bytes, and that all you have to do is read the buffer for 18 bytes, over and over.  Is this correct?  ~~ edit ~~  is it possible the instrument has filled up a buffer and you are busy reading old data? ~~

 

Also, I did not read through the parser section, we'll assume this is correct.

 

***

 

If you start the code with different throttle settings do you get different results 'per run' ( presumably that remain constant, as this is the issue at hand)?

-------
Mark Ramsdale
-------
0 Kudos
Message 7 of 12
(3,366 Views)

I wanted to see if you could independently verify the instrument is replying correctly when the throttle is changed.  MAX can be used like a hyperterminal, so you can read over and over again in max to see what is being sent by the instrument.    ( or just use a hyperterminal program)

 

If I change  throttle I take different results, but I have to run the code again every time that I want to change my throttle. The use of this code is to get data from a turbojet for transient phenomena, so I need to be able to change the throttle whenever I want.

 

The example code seems to say that the instrument is constantly sending out 18 bytes, and that all you have to do is read the buffer for 18 bytes, over and over.  Is this correct?  ~~ edit ~~  is it possible the instrument has filled up a buffer and you are busy reading old data? ~~

 

The problem, as I realize it, is that when the DAQ-Assistant is in the while loop, it never stops, so if I change something for VISA it doesn't affect anything because it doesn't check again the part out of the loop. So if you could suggest any way to read out of the loop the data of DAQ-Assistant or to make a loop for DAQ-Assistant and another one for VISA and then synchronize them , maybe it could work.

 

 

 

0 Kudos
Message 8 of 12
(3,361 Views)

Hi,

 

Each instrument ( DAQ / Serial ) has its own data flow, and they don't interact in this loop.  So having them in different loops won't solve the issue of the serial data not updating when the physical throttle is changed.

 

You have mentioned parts out of the loop, but in this VI there is only parts in the loop, not sure what to say there.  If you mean the serial initialization, that is fine where it is.

 

I'm a bit curious about the serial device, as it seems to be being used as a 'dumb' transmitter, turn on and it broadcasts at some rate.   Is it possible there are a lot of messages queued up?  If you were to read, say ten times 18 bytes, would you get 10 sets of data?  

What does the manual say 🙂

 

***

 

You might try disabling the DAQ portion of the loop (disable structure), and concentrate on the serial communication.  I don't see how the DAQ would interfere with serial communication, as there is no shared data.  It does interfere by imposing a timing constraint, it is probably very slow, compared to a single serial read, making the overall loop longer.  But I don't think you are trying to run at a particular rate.

 

 

 

 

 

-------
Mark Ramsdale
-------
0 Kudos
Message 9 of 12
(3,356 Views)

When the serial device is alone(without DAQ) works perfectly...I've just made a code with traditional DAQ and it can renew the data regularly and takes also the throttle changes. But in this way the DAQ mx that reads the data is also out of the loop...do you know if there is a similar way to do this with new NI-DAQmx?

0 Kudos
Message 10 of 12
(3,348 Views)