Hello!
I'm trying to build a simple temperature logger based on picaxe 28x1. The goal is to build a device, that once per minute reads the temperature on DS18B20, adds them to a temporary location. Then, once per day the average temperature during the day is calculated, and also a min / max temperature picked from the table, and stored into an external 24lc16b eeprom.
The reason i put the crystal in with the picaxe, is that i would like to use the settimer command to keep accurate time with the crystal. However, while testing the timing, i noticed it was off by almost 2%(time was running 2% too slow in the picaxe).. Now i started to think about possible reasons. First thing that came to my mind was the sertxd command, that i used to transfer the elapsed time back to computer.. Does sertxd cause the 28x1 to switch back to the internal timer, or does it work with the external crystal, because it's also 4MHz? Also, in the future when i will use the readtemp command, will it switch to internal 4MHz, when running on external 4MHz? The datasheets mention about switching to 4MHz while doing the temperature conversion, but will it always switch to internal, if the external frequency is also 4MHz?
Another thing are the loading capasitors with the crystal.. I saw some site mention they should be something in between 10 - 47pF, I went with 10pF, since i had those plenty at hand. What exactly do the capasitors do in the circuit, and are they related to the oscillating frequency?
below is the code i used for testing, and a picture of the pcb, and layout.
I'm trying to build a simple temperature logger based on picaxe 28x1. The goal is to build a device, that once per minute reads the temperature on DS18B20, adds them to a temporary location. Then, once per day the average temperature during the day is calculated, and also a min / max temperature picked from the table, and stored into an external 24lc16b eeprom.
The reason i put the crystal in with the picaxe, is that i would like to use the settimer command to keep accurate time with the crystal. However, while testing the timing, i noticed it was off by almost 2%(time was running 2% too slow in the picaxe).. Now i started to think about possible reasons. First thing that came to my mind was the sertxd command, that i used to transfer the elapsed time back to computer.. Does sertxd cause the 28x1 to switch back to the internal timer, or does it work with the external crystal, because it's also 4MHz? Also, in the future when i will use the readtemp command, will it switch to internal 4MHz, when running on external 4MHz? The datasheets mention about switching to 4MHz while doing the temperature conversion, but will it always switch to internal, if the external frequency is also 4MHz?
Another thing are the loading capasitors with the crystal.. I saw some site mention they should be something in between 10 - 47pF, I went with 10pF, since i had those plenty at hand. What exactly do the capasitors do in the circuit, and are they related to the oscillating frequency?
below is the code i used for testing, and a picture of the pcb, and layout.
Code:
#picaxe28x1
init:
setfreq em4
settimer t1s_4
main:
toggle 7
pause 500
toggle 7
pause 500
let W0 = timer
sertxd ("seconds elapsed ", #W0 , " _")
goto main
Attachments
-
27 KB Views: 46
-
66 KB Views: 41