Hello TJF, Thank you for the explanation that is very useful! With parsing the file, I'm doing that in Node-Red reading in the file as a binary buffer, but for some reason the buffer is 4x the number of sampling points I set. Like let's say I tell the script to sample the analog inputs 5000 times, the file will come back with 20000 when I read it into Node-Red (I'd expect 10000 points since I'm using 2 analog inputs). What could be the cause?
Thanks! On Wednesday, March 10, 2021 at 2:26:30 PM UTC-5 TJF wrote: > Hi! > > [email protected] schrieb am Dienstag, 9. März 2021 um 21:15:01 UTC+1: > >> Specifically, they are collecting the data using Ring Buffer mode and >> saving it to a text file to be processed further for some feature >> extraction and further analysis. >> >> What I'm trying to understand is this: how does Ring Buffer sampling >> actually work? As in, if I'm reading data using two analog inputs and >> saving it to a text file, what order are the values in? How do I parse them >> into meaningful sensor values? I've attached the C code I'm working with, >> and greatly appreciate any help or pointers! >> > > Your code doesn't save to a text file. Instead it saves the raw data to a > binary file. The unshifted values (0-4095) are stored as 16-bit (unsigned > short) binary numbers in the order as captured, like > > AIN-1, AIN-2, AIN-1, AIN-2, AIN-1, AIN-2, AIN-1, AIN-2, ... > > In order to parse the file, just read it into a buffer and access that > buffer by a unsigned short pointer variable. 0 (null) means 0V, 4095 means > 1V8. So multiply the unsigned shorts by the factor 1.8/4095 to get the > voltage as a real value. > -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/c5efd6f1-2dd7-48ee-a693-182a8710f539n%40googlegroups.com.
