Measuring the duration/time of an event using BS2px
Leo.K
Posts: 21
Hi there,
I'm trying to calculate the amount of time the BS2px is performing a task. In this case reading the voltage value from an accelerometer axis then outputting it over serial to a USB stick before returning to repeat the process for the next axis.
I require the time for the constant acceleration equation v = u + at.
I've researched a lot·but have only found a solution for the propeller chip using the system's clock·- CNT.
Is there a method/s that exist for the BS2px? I'm not sure if it will make a difference but the axis values are read on one EEProm then I use "run 2" to run the next EEProm that writes the value to the USB drive.
Any pointers would be much appreciated
Thank you
Leo··
I'm trying to calculate the amount of time the BS2px is performing a task. In this case reading the voltage value from an accelerometer axis then outputting it over serial to a USB stick before returning to repeat the process for the next axis.
I require the time for the constant acceleration equation v = u + at.
I've researched a lot·but have only found a solution for the propeller chip using the system's clock·- CNT.
Is there a method/s that exist for the BS2px? I'm not sure if it will make a difference but the axis values are read on one EEProm then I use "run 2" to run the next EEProm that writes the value to the USB drive.
Any pointers would be much appreciated
Thank you
Leo··
Comments
You could perhaps use the 60 Hz ac line frequency to get a time reference, high for 8 1/3 ms and low for 8 1/3 ms. The BS2px cannot execute a lot of code in that short time, particularly if it involves serial writing the the USB stick. In the Stamps, everything has to be done by polling.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
As I mentioned, I am trying to read the X and Y axis voltage and write them to the USB Drive. Then loop this many times until the user stops the process. Is this a particularly bad idea as you say the serial comms are slow? and I would be assuming acceleration was constant during this writing stage. I could datalog them first but I believe I would be limited to something like 1000 readings in total before the eeprom became full. Is that right? Could you maybe suggest an alternative·method if that is the case? I'd like it to record maybe at least 30 seconds of activity. And ideally 10-15 minutes worth.
Thanks again
Leo
·
Tracy's concern is about the time it takes to communicate with the datalogger. There's a bit of overhead in writing and time is tight. You might consider adding a pair of 24C1024 Atmel EEPROMs which would give you 256K of data storage with only 2 I/O lines needed. That would be room enough for 100 readings a second for 10 minutes and the BS2px has the I2CIN / I2COUT statements for quick and easy access.