DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Communication

Solved!
Go to solution

I am trying to establish serial communication between DASYLab and an MPU sensor (MPU 9050). From what I've read, DASYLab handles serial communication through the RS-232 serial protocol whereas the sensor seems to use the I2C communication protocol. Is the only fix to use and I2C RS232 adapter or is there a workaround within DASYLab?

0 Kudos
Message 1 of 7
(5,263 Views)

If it's not straight serial, then you would need to write a driver 

 

If, when connected to the PC, it enumerates a COM port, then the DASYLab RS232 Input can read it. 

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 2 of 7
(5,190 Views)

CJ,

 

I connected the sensor to an Arduino which enumerates a COM port. Now I just have to parse the signal.

Thank you for your help.

0 Kudos
Message 3 of 7
(5,172 Views)

I currently have a continuous data string stream as the sensor is continuously outputting. This is shown below. I am now trying to have 6 channels within a single RS232 module with each reporting one of the six numerical values. Following a bit of research, I know this can be done using the “Measurement data format” field. I have been playing around with it but have not been able to figure it out.

 

Note that I have control over the formatting of the string and can therefore remove the RX, RY…. labels if needed.2.PNG1.PNG

0 Kudos
Message 4 of 7
(5,160 Views)
Solution
Accepted by JP2020

Well done! You're almost there. 

 

each value has a two character identifier. 

 

For each channel, enter "RX " a\x20

where the quoted string matches the next value. 

 

The last channel will be "AZ " a \r\n

 

DASYLab will look for the quoted string, so the channels should be in order, RX, RY, RZ, AX, AY, AZ

Once it has found the string, it will interpret the next characters as number values until the delimiter -- the space character. 

 

So, accounting for all of the characters on the line, up to and including the <CR><LF>, this is the channel string. 

Ch 0: "RX " a\x20

Ch 1: "RY " a\x20

Ch 2: "RZ " a\x20

Ch 3: "AX " a\x20

Ch 4: "AY " a\x20

Ch 5: "AZ " a\r\n

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 5 of 7
(5,156 Views)

I did as you instructed and it seems to identify the strings correctly and the associated values (I did have to delete the space between the string identifier and numerical value).

 

Could you explain the data format a little more. I understand the string identifier, but I do not understand where a\x20 and a\r\n come from. Also, what exactly do you mean by channel string?

 

Thank you so much for the help.

0 Kudos
Message 6 of 7
(5,153 Views)
Solution
Accepted by JP2020

That's great. 

 

a tells DASYLab to look at the characters and make them into numbers, delimited by some other character -- space, comma, return, etc. 

DASYLab has short cut notation for tab \t, return \r and linefeed \n, but not for comma or space. So, you have to use the hex value for that character -- 0x20 is space, 0x2c is comma. 

 

So, a\r\n tells DASYLab to identify the first number on the line that ends in <CR><LF>

a\x20 tells DASYLab to identify a number followed by a space. 

 

Your string is space delimited until the end of the line. 

 

DASYLab is scanning the buffer, from left to right of the line. For your string, we need to anchor each value with the two character text field -- that's the search string and then tell it what characters to interpret as a number. 

 

If you had  valueRX,valueRY,valueRZ,valueAX,valueAY,valueAZ<CR><LF> the data format would have been simpler... 

 

0: a\x2c

1: a\x2c

...

5: a\r\n

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
Message 7 of 7
(5,146 Views)