Output ok, input not on 08M2

PersonX99

New Member
I (am new to Picaxe) was working with the 08m2 and had no problems building/testing example circuits triggering output pins on the 08m2.
When I tried example input circuits, I could not get any of the input pins to register correctly.

I used the following program:
input c.3
main:
sertxd ("input value ", #pinc.3, cr, lf)
goto main

and the example circuits on pg 26-27 of the manual. No success.

I then swapped out for another 08m2 and everything worked fine.

I wonder how this is possible that output pins work but input pins do not? Does anyone know what would cause the 08m2 to behave in such a way?

Thanks. :)
 

russbow

Senior Member
Your input c.3 only makes the pin an input pin. On the 08m2 , c.3 can only be an input anyway.

You are not reading any data on that pin that you can display.
 

westaust55

Moderator
Further to russbow's comments, if you have a look at PICAXE manual 1:http://www.picaxe.com/docs/picaxe_manual1.pdf
at page 10 you will see the pinout for the 08M2 (pages 9 to 11 cover the range of PICAXE chips).

There you will see many pins have "In/Out" capabilities but for the 08M2 (and also 14M2) pin C.3 in "In" only. Likewise for the C.5 with the 18M2 and C.6 for the 20M2.

Pin-Out information for the PICAXE chips can also be found on the Rev Ed website here: http://www.picaxe.com/What-is-PICAXE/PICAXE-Pinouts/
 

PersonX99

New Member
In the sample program, I also tried changing the line: input c.3 to (input c.x where x= 1,2, or 4). The variable in the sertxd command was also changed as well to match which one was attached to an input switch.

russbow, when you said "You are not reading any data on that pin that you can display.", does this mean that there is a specific command to read an input pin? I thought the #pinc.3 in the sertxd command in my program above did that. Is there another command that I may have missed?

Thanks for the feedback.
 

hippy

Ex-Staff (retired)
I then swapped out for another 08m2 and everything worked fine.
It does sound like the PICAXE you were using has been damaged in some way or there was some difference between the set-up where it worked and the one that did not. It might be worth re-testing the one that did not work to see if it still doesn't or now does.

A damaged chip can behave in all sorts of odd ways depending on how it has been damaged. When you say you had "no success" what results did you actually get ? That might point to some ideas as to what might have gone wrong but it might not actually be worth pursuing.
 

russbow

Senior Member
You need to assign data received on the pin to a variable, say b1 and then sertxd that variable to display the value.

You can inspect the state of the pin and do some thing if it is high or low. That means you have taken it to +ve or 0 volts

Have a look at manual 3, page 26 to see how to do this with a push button
and also manual 2 page 104 to see the if / then commands.

or you can serial in data to the pin and assign that data to a variable.

Have a look at this code.

Code:
#picaxe08m2
let b1=0

do
if pinc.3=1 then let b1=b1+1
endif

sertxd ("Value of b1 = ",#b1,cr,lf)

pause 2000

loop
First of all it tells the system we are using the picaxe 08m2 ( #picaxe08m2 )
Then it sets the variable b1 to zero (let b1=0 )

It will then run through to DO / LOOP routine forever, checking the input pin and if it is high - button pressed - incrementing b1 ( let b1=b1+1 )

If the button is not pressed , pinc.3 is 0, do not increment b1

Finally sertxd the result, pause 2 seconds and do again.

Bit long winded, but look at it line by line until you understand it
 

PersonX99

New Member
Many thanks for the detailed response. (detailed is not the same as long-winded to me). I will go through this step by step to ensure I under stand it. I'm starting to think I should go ahead and read the entire manual first rather than use it as a reference. :)
 

hippy

Ex-Staff (retired)
Just a quick note to say that the command -

sertxd ( "input value ", #pinc.3, cr, lf )

Is entirely valid and should have done what was expected; read the level on pin C.3 ( leg 4 for an 08M2 ) and show a "0" or "1" on the terminal display, and does do that for the 08M2 that is working as expected.

The original code is pretty much exactly what we would use here to initially test our PICAXE chips if someone reported an input pin were not behaving as it were expected to.

It's also a good example of "substitution" as a means to identify the source of a problem; if it works on one chip and not another it's more likely to be a chip or circuit issue than a PICAXE firmware or compiler issue, and if it works on one then the circuit would seem to be generally correct.
 

PersonX99

New Member
I did resolve the question in that other thread by using a different 08M2. It is odd indeed, but I need to verify again that I get different results from the two 08M2 chips. My plan is to capture the results from the output performing identical tests. I have done this already, but I did not record the results. I do not have decoupling capacitor fitted in my test circuit.

I noticed that you previously asked about this.

It seems odd that one 08M2 will work and the other will not work. It certainly looks like the one PICAXE-08M2 is faulty. Do you have decoupling capacitors fitted?
 

SAborn

Senior Member
I do not have decoupling capacitor fitted in my test circuit.
That could well be the problem and well worth fitting them, IMO they should be part of the very basic components required, along with the 2 serial port resistors.

Are you using a pullup or pulldown resistor on the input pin in your circuit.

The little darlings dont just fail for no reason, and almost always its a operator error, in circuit or program, i have used several hundred 08m2 and never had a problematic chip amongst them.
The only one i have killed was due to 24v supply to the chip. ( im still trying to work out if that was a user error or a picaxe design fault :confused: )
I knew i killed it because of that bad smell they make at death and the loud CRACK as it blew itself to bits. (Rev-ed needs to use better glue to hold them together ;) )
 

PersonX99

New Member
Oh I think if it is "faulty", it is definitely something I did.
I'm a bit new to this and prone to the simple mistakes one learns along the way.
I was using an AXE021 protoboard, but I think I need to resolder the 3.5mm plug on it. It seems a bit faulty. I am using the breadboard mountable download circuit now and it is flawless (my soldering skills have improved).
 
Top