08m datalogger problems

jppostkw

New Member
Hi everyone first post. I very recently delved into the world of picaxe. I am building profmasons 08m datalogger and have a couple questions/ problems.

First off i built the regulated supply put it into a project enclosure. Than i built the circuit on a proto board from rev ed but when i test the switches
using this program

main:


if pin3 = 1 then goto LEDON
if pin4 = 1 then goto LEDON
low 2


goto main

LEDON:


high 2


goto main

The LED stays lit. But if i run my hands on the bottom of the board i can get the led to go out and press the buttons and it lights up.
I switched out switchs to ones with a higher open restsiance same thing. I than put it on a bread board to see if it still happens and took the switches out of the equation and touched two wires together from +5v thru a 1k ohm resistor and than into pins 3 and 4 same problem.


next problem i have is when i downloaded a chip with actual data logger program:
symbol samples = 50 &#8216;The number of samples to take (<=200)
symbol adc = 1
symbol counter = b2
symbol led = 2
symbol interval = 100 &#8216;time between taking samples in ms

main:


if pin3 = 1 then takedata
if pin4 = 1 then readdata


goto main

readdata:


for counter = 1 to samples


read b2,b0 &#8216;read the data
sertxd (#b0,&#8221;,&#8221;) &#8217;send the dataout to the terminal


next counter


goto main

takedata:


high led
for counter = 1 to samples


readadc10 adc,w0
pause interval
write b2,b0 &#8216;write the data to eeprom


next counter
low led


goto main

i get an error in the sertxd line and have not found anywhere in the manual or online that explains it..
thanks in advance

paul
 

sghioto

Senior Member
Paul,

I see several problems. As BeanieBots was saying you need to have 10K pulldown resistors on pin3 and pin4 in the test circuit. The way your code is written the LED should stay lit as long as one or both of the switches is on or held down.
As far as the code: >> sertxd (#b0,",") ’send the dataout to the terminal <<
it appears you are using the wrong syntax to seperate the code from the comments.

Steve G.
 

Peter M

Senior Member
seems a little strange... if I cut and paste your code into prog editor (5.2.4) it doesn't seem to recognise " or ' symbol (changes them to some strange characters), so I retyped those in, but as a seperator, ' or ; or ` all work fine.
And apart from the strange copy paste thingy, your code seems to compile fine for an 08m.
I havn't looked to see what picaxe the data logger uses though.
 

jppostkw

New Member
Thanks for the quick responses i changed the hyphen on the sertxd command and it worked now i just need to get home to try the pull down resistors which im still kinda fuzzy on where they need to go. i.e. in front of the switches where 5 v comes in or after the switches to the pins 3 and 4 in some other configuration.

Paul
 

lbenson

Senior Member
This will work for a switch:
Code:
        _|_
4.5V ---- ----o---pin3
              |
              -
             | | 100K
              -
              |
              0v
The resistor, 10K to 100K, keeps the input pin from floating (having indeterminant value) when the switch is released.
 

jppostkw

New Member
Alright guys thanks for the help. i put a 47 k from ground to pin 3 and 4 and than hooked the switches up from v+ to pin 3 and 4 the ledon program works now.
I have one more quick question do i need to leave the 1k resistors from v+ to the switches or where they playing the role of a pull up resistor?


thanks again
Paul
 

BeanieBots

Moderator
The 1k resistor is to protect the 08M input pin.
If you (accidentally) used that input pin as an output and then used the push-switch to pull it high when the PICAXE was trying to pull it low, you would need to buy a new PICAXE. I'd suggest you keep it.
 

jppostkw

New Member
Thanks for the info guys i have it all working properly. mounted it in a camel snus tin put a 3 ft lead of cat five and the lm35 in a piece of .25 inch stainless tubing and got the sensor water proofed still using the external regulated supply....I ran my first data logging program and dumped it into terminal window. ie pushed f8
And i got jibberish... i cant download vb.net as my work computers block the program. I looked around but couldnt find another program that is documented about converting the sertxd data to usable numbers. are there other options that i havent found?



thanks in advance.

Paul
 

lanternfish

Senior Member
The # gives the ASCII character for the value stored in b0.

To output the b0 value in a more user friendly way, use bintoascii, b0,b3,b4,b5 to convert the b0 value to its constituent Hundreds, Tens, Unit values. Then sertxd (#b0,&#8221;,&#8221;) becomes sertxd (b3,b4,b5).

Refer to page 29 of the commands manual for for info on the bintoascii command.

cheers
 

jppostkw

New Member
@ lanternfish i rewrote the code and ran a data log dumped it out and got this.
TßTßTßTßTßTßTßTßTßTßTßTßTßTßTßTÝTÝTÝTÝTÝTÝTÝTÝTÝTÝTÝTÝTÙTÙTÙTÙTÙTÙTÙTÙTßTßTßTßTßTßTßTßTßTßTßTßTßTßTßTßTßTßTßTßTÙTÙTÙTÙTÙTÙTÙT

my code looks like this now:

Code:
symbol adc = 1
symbol counter = b2
symbol led = 2
symbol interval = 100 &#8216;time between taking samples in ms

main:


if pin3 = 1 then takedata
if pin4 = 1 then readdata


goto main

readdata:


for counter = 1 to samples


read b2,b0 &#8216;read the data
bintoascii b0,b3,b4,b5 
sertxd (b3,b4,b5) 'send the dataout to the terminal


next counter


goto main

takedata:


high led
for counter = 1 to samples


readadc10 adc,w0
pause interval
write b2,b0 &#8216;write the data to eeprom


next counter
low led


goto main

i read up on it all and seemed to have missed something
do i need to make a sub routine or something
 

Technical

Technical Support
Staff member
In the terminal window make sure the baud rate is set to 4800 (looks like it is not!)

An easy way to do this is to add the following directive as the first line into your program to force the terminal to open after download at speed 4800

#terminal 4800

Also change this line
sertxd (b3,b4,b5)
to
sertxd (b3,b4,b5,CR)
to get each reading on a new line
 

Technical

Technical Support
Staff member
Also you are reading a word variable but only saving a byte. To start with change

readadc10 adc,w0
pause interval
write b2,b0 &#8216;write the data to eeprom

to

readadc adc,b0
pause interval
write b2,b0 &#8216;write the data to eeprom
 

jppostkw

New Member
Thanks Technical i will give it a shot after this ecm flash file im working on downloads into the the truck if i can get this datalogger to work well i have potential to get company endorsment for it :D
 
Top