LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multi signals acquisition from the same serial port

Hi sam,

 

Because I receive the data on ASCII format. So I convert it into bytes array to only use the first two bytes and convert it to decimal to read the voltage value.

Wrong: if it would be an "ASCII" format you could use text conversion functions instead of joining bytes…

This still doesn't explain the Rube-Goldberg construct of ArrayToCluster followed by Unbundle! Can you supply a document describing all the details of the device communication?

 

So I empty it for the next commands 

It would be much better to read the whole message (including any TermChars) instead of repeatedly flushing the buffer!

 

So If you have a solution to read the three signals simultaneously it will help me a lot. 

AFAIK from your VI you need to send a command to your device to receive the requested value: you cannot request the "signals" simultaneously then!

 

I don't know it, thank you for mention it. Is that a subVI ? i will try it

Why don't you read the LabVIEW help on "AutoCleanup"?

It's not a subVI, but a button in the VI menu bar!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 11 of 26
(725 Views)

@sam2017 wrote:

You read 3 bytes and convert the string to an array of bytes. Then you convert that array to a cluster of 9 elements (!?) to use Unbundle: why don't you just IndexArray the array elements? Much easier, simple, self-documenting, …

=> Because I receive the data on ASCII format. So I convert it into bytes array to only use the first two bytes and convert it to decimal to read the voltage value.


But you are not treating it as ASCII data.  You are treating it as raw data.  So let's all take a step back....

 

What is the device you are trying to communicate with?  Does it have a manual with the message protocol?  What is the EXACT message protocol?  Until we get the details of the protocol, we will just be running completely blind and the assumptions will just cause more harm than good.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 12 of 26
(721 Views)

I'm using a module HB628.

Here is the datasheet ( German version)

0 Kudos
Message 13 of 26
(716 Views)

Hi sam,

 

why don't you read that manual? See page 3 and 7 for clear instructions!

When you want to read all channels at the same time you should use the command "c09" to receive 17 bytes!

Just a rough sketch:

check.png

 

And NO: this is not an "ASCII" format…

Instead it's a rather bad message format with no explicit TermChar and no indication how many bytes to read! (That's what you get with this rather cheap hardware as it seems.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 14 of 26
(714 Views)

Hi GredW,

 

I know about "c09" but I didn't use it because I only need 3 channels.

I made an ECG board ( from Operational Amplifiers). I'm using 3 Op-Amp that's why I need only 3 channels from the module HB628 to send each signal of the 3  Op-Amps to the interface (computer) to visualize it.

 

If I use "c09" it will concatenate all the data of the 8 channels to one value which is not what I need 

0 Kudos
Message 15 of 26
(706 Views)

@GerdW thank you for the sketch.

 

And NO: this is not an "ASCII" format…

Instead, it's a rather bad message format with no explicit TermChar and no indication how many bytes to read! (That's what you get with this rather cheap hardware as it seems.)

=> You might be right, do you have any alternative hardware for acquisition? ( I can't afford to buy NI components).

 

Best regards.

0 Kudos
Message 16 of 26
(717 Views)

Hi sam,

 

the USB6000 also supports 8 AI channels at 95€.

And the excellent DAQmx driver is included…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 17 of 26
(716 Views)

ECG ????  Cardio ?

Do you connect this hardware directly to a (still living) human body? Without isolation amplifier?

Whow, a candidate for the Darvin award!

 

To GerdWs hint: Since you read 17 bytes the decimate to 2 arrays will drop the check sum byte.. (read Help of decimate 1D Array function) and leaves the 8 U16 values you need to scale to voltage.

I attached a check ... seems to work from the example shown.

HB628check01.png

Scaling to SI units is now your homework 😄

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 18 of 26
(715 Views)

Hi sam,

 

I know about "c09" but I didn't use it because I only need 3 channels.

But using the c09 command is MUCH FASTER and RELIABLE than to request 3 channels one after the other. (You wanted to read the channels "simultaneously" but refuse to listen to advice!)

And by using IndexArray you can easily pick the channels you need…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 19 of 26
(705 Views)

Hi guys, I tried to apply what you told me in my VI. But, I still can't visualize the proper signals as it is shown in the picture in the Oscilloscope down below. I attached my VI too. 

Download All
0 Kudos
Message 20 of 26
(672 Views)