Hi!

Am Samstag, 3. Oktober 2015 22:43:04 UTC+2 schrieb Rathin Dholakia:
>
> Dear TJF,
>
> Sorry to bug you with a silly question, I thought being a binary it must 
> have some specific encoding rel. to library hence I asked it. I didnt knew 
> it was lack of knowledge. I am sorry...!!
>
> Never mind!
 

> I Have figured out the way to read binary (code pasted bellow for others;) 
> but I have a doubt in it that I have lot of Zeros & negative readings as 
> well 
> Is it because of my decoding error or is it the samples themselves missing.
>
> As I said, I'm no C expert. Here're my comments:

   - I'd fopen() for read.
   - I'd check the return value from fread() in order to avoid missreadings 
   (= interpreting memory garbage).
   - Most important: since Adc->Value is an Uint16*, the result array has 
   to get declared as
   unsigned short result[100];
   
Here's code I use (FB syntax):


IF OPEN(fnam FOR INPUT AS fnr) THEN
  ?"Cannot open " & fnam
ELSE
  DIM AS USHORT v
  VAR cc = 8, c = cc, i = 0
  ? i & ": ";
  WHILE NOT EOF(fnr)
    GET #fnr, , v
    ? v,
    c -= 1 : IF c <= 0 THEN i += 1 : c = cc : ? : ? i & ": ";
  WEND
  CLOSE #fnr
END IF

It reads the complete file and formats the output in 8 columns (cc = 8).


BR

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to