I have a Logomatic V2 that I’m trying to use as a long-term data logger. I’d like to collect data at a once per second (1Hz) rate.
When I change the frequency = line in the configuration file to:
frequency = 1
The unit powers up normally, the lights flash, then it does nothing. Upon hitting stop and removing the card, I see it has created a data file but that the data file is empty.
If I use 10Hz and up, it works fine.
Anyone know how to slow it down below 10 Hz? The manual says that 1 Hz is the lower limit, but it seems like actually this is 10 Hz?
Which requires an absolute minimum of two characters so you can get 1Hz by adding a leading “0”. ie.
Frequency = 01
Frequencies much less than 1Hz can be had but the configuration file limitations prevent using them. The key step is:
T0MR0 = 58982400 / freq;
Since T0MR0 is a 32 bit value it could generate interrupts every 72 seconds. Even slower if the prescaler were used. But the fact that “freq” is an integer prevents that.
A parameter of “1” generates an unexpected number for T0MR0: zero. Which, if I read the data sheet correctly will generate an interrupt each time the counter rolls over or about 72 seconds.
A much better way to convert the number is to back a pointer up to the first digit and then call atoi().
I had started digging into the code before dinner. Being mostly a MikroE MikroBasic kind of PIC-programmer, looking at C code took me a little bit of brainwork. (okay, it gave me a migraine so I had to put it down.)
I never did figure out that the configuration file parser required two digits minimum - thanks much! Right now I’m recording data at 1 Hz (frequency = 01) without problems. This is fantastic!
When I was looking at the code, I had found my way down to the timer lines, but then stumbled greatly. I started looking at the “UM10139” User Manual from Philips looking at the prescale register (T0PR) was thrown off by the fact that in the code that this is 0x0000000 - or zero. How can the prescaler be zero and the timer still work? Then I read the manual where a prescaler = 0x00000000 simply means that the clock is used as is without dividing by the prescaler. A value of 0x00000001 would then count every other clock count.
My initial thought was to set the prescaler to 9 (whatever that is in hex) and give that a whirl following the bootloader example on SparkFun’s pages. I figured that would then allow the prescaler to count every tenth clock, making frequency = 10 to really be 1 Hz.
But now that 1 Hz is working, I may not need to fool with it unless I do some very long period data logging…