phyphox Forums
Converting 20-byte int16 into 10 little endian values - Printable Version

+- phyphox Forums (https://phyphox.org/forums)
+-- Forum: Discussion (https://phyphox.org/forums/forumdisplay.php?fid=1)
+--- Forum: Experiments and Ideas (https://phyphox.org/forums/forumdisplay.php?fid=4)
+--- Thread: Converting 20-byte int16 into 10 little endian values (/showthread.php?tid=1426)



Converting 20-byte int16 into 10 little endian values - hpm - 09-09-2021

Hi there,

I am writing an experiment with a BLE characteristic that indicates 20-byte int16 values at once. I am trying to convert them into 10 little-endian values but I am struggling to do so using the phyphox editor as I have no experience with XML  Huh

I've tried setting the length to 20 bytes (shown in picture) but it seems to be only converting the first two bytes.

Could someone point me in the right direction please? Much appreciated!! 
   


RE: Converting 20-byte int16 into 10 little endian values - Jens Noritzsch - 09-09-2021

Hi hpm,

the output tags for bluetooth input do not support arrays, so you need to individually define each of the 10 values. The offset attributes have to be altered accordingly. (0, 2, 4, … for two byte values).

HTH


RE: Converting 20-byte int16 into 10 little endian values - hpm - 09-10-2021

(09-09-2021, 06:51 PM)Jens Noritzsch Wrote: Hi hpm,

the output tags for bluetooth input do not support arrays, so you need to individually define each of the 10 values. The offset attributes have to be altered accordingly. (0, 2, 4, … for two byte values).

HTH

Hi Jens, 

Thank you so much for the reply,

I have tried to individually define each of the 10 values where each value is representing an acceleration reading that I gathered. I am now able to generate these acceleration values successfully, but when I tried to add a time value to each of the 10 readings I encountered some more problems.

I generated the first time value by setting the 'extra' field in one of the output buffers to 'time'. For generating time values for the rest of the 9 acceleration readings I tried adding a small time increment each time (0.001 second) using the 'ramp' module. Then when I tried to plot the acceleration readings against time values I get really weird results as shown in the picture. The time values generated seemed to be repeating themselves and my guess was that there's something wrong with clearing the buffers. So I tried various combinations of clearing the buffers but none of them seemed to be working. 

Would you mind pointing me in the right directions again on how to add time values in the editor please? Thank you again for helping me!!

I have also attached my phyphox experiment file here if it helps.
   
   

.phyphox   nrf52_with_10byte_buffer.phyphox (Size: 9.88 KB / Downloads: 66)


RE: Converting 20-byte int16 into 10 little endian values - Jens Noritzsch - 09-13-2021

These have been busy two days. There should be time to look into it tomorrow/Tuesday. Could you add an export block and provide us the collected data?


RE: Converting 20-byte int16 into 10 little endian values - Jens Noritzsch - 09-14-2021

Please note that your analysis block continuously runs even if there is no new data. I am not yet entirely sure of the consequences for the graph. A .csv of the data could really help.

BTW, there is now a “repeating” attribute in the “input” element for such cases, see https://phyphox.org/wiki/index.php?title=Bluetooth_Low_Energy, however, it is not (yet?) supported in the editor.