Shop OBEX P1 Docs P2 Docs Learn Events
DataLogger Trouble — Parallax Forums

DataLogger Trouble

HeavyHeavy Posts: 6
edited 2010-07-12 22:55 in Propeller 1
Hello, I'm trying to use DataLogger_UART_Driver to make a usb datalogger. When I try to write data as I sample it, I can only sample at 10Hz to 20Hz. In an effort to try to sample faster, I am trying to write data to a variable at about 100Hz or so , then write it at 10Hz. But I'm having trouble writing the data to a variable. Here's my code.


VAR
   long data[noparse][[/noparse]200]
  
OBJ
Num : "Numbers"
PST : "Parallax Serial Terminal"
DLG : "DataLogger_UART_Driver"
     
PUB DataGetter(filenm) | tic,  ptc 
  tic := 0
     
 repeat while tic < 50
  ptc := num.tostr(INA[noparse][[/noparse]7], num#dec)     
  bytemove(data + strsize(data) , ptc, strsize(ptc) + 1)
  tic++
  waitcnt(clkfreq/100 + cnt)
 
 

This works until tic reaches 20. Then everything goes haywire. What am I doing wrong?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-07-12 22:55
    The problem is that you're using "data" in two places where you should have "@data".

    I'll bet you're used to programming in C where, if you give the name of an array, the compiler provides the address of the first element.· In Spin, you get the contents of the first element.
    ·
Sign In or Register to comment.