01-16-2019 05:48 AM - edited 01-16-2019 05:49 AM
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!
01-16-2019 06:23 AM
@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.
01-16-2019 07:03 AM
I'm using a module HB628.
Here is the datasheet ( German version)
01-16-2019 07:36 AM - edited 01-16-2019 07:40 AM
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:
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.)
01-16-2019 08:10 AM
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
01-16-2019 08:14 AM
@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.
01-16-2019 08:31 AM
01-16-2019 08:32 AM
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.
Scaling to SI units is now your homework 😄
01-16-2019 08:35 AM - edited 01-16-2019 08:39 AM
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…
02-13-2019 10:22 AM
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.