Using the Propellor for state data logging
learning
Posts: 2
I am new at programming microcontrollers, and am wondering if it is possible to use the Propellor to create a data logger with an extremely high sample rate.
What I need to make is a data logger that will record the change of state (On/Off), with the accuracy of a few milliseconds, and record it to an SD card.
Is this possible? How would I go about doing it?
What I need to make is a data logger that will record the change of state (On/Off), with the accuracy of a few milliseconds, and record it to an SD card.
Is this possible? How would I go about doing it?
Comments
Hanno
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Download a free trial of ViewPort- the premier visual debugger for the Propeller
Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
Look at the "waitpne" command. You can use it to suspend the cog until the input pins change state. As soon at the state changes, you can grab the new state and a snapshot of the time. I would recommend placing both the pin state (a 32-bit long) and the counter value (also a 32-bit long) into a buffer (sized for example 1024 bytes or 256 longs). Once you have 512 bytes of data logged you hand off that data to fsrw to write to a SD card for you. Meanwhile you continue logging state changes to the next part of your buffer. When the next 512 bytes are ready to go, hand them off, etc.
I would recommend that you also set up your code to take periodic snapshots of the pin state, even if the state hasn't changed, say every 2^30 clocks. That way you can never have your clock counter roll over and miss it.
This application would be simple enough that you could use most of the Hub RAM for a buffer, so any SD card speed hiccups won't mess you up.
Note: if you want to do de-bouncing you will probably want to do that right after the cog wakes from the waitpne command.
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
lonesock
Piranha are people too.
This kind of thing is very easy with the Propeller, don't worry too much about the exact details for now, just get into it because the Prop will not have any problems.
*Peter*
I will have to spend some time to digest this, and thanks again for all your help, it's much appreciated.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBladeProp, RamBlade, TwinBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80), MoCog (6809)
· Search the Propeller forums (via Google)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm