Simulator promlem?

lewisg

Senior Member
Pin C.4 will only turn off, never on
Code:
#picaxe08m2

high C.1
high C.4
pause 2000

main:

  toggle C.1
 
  If pinC.1 = 0 Then
    Low C.4
  Else
    High C.4
  End If
  pause 2000
    
  If pinC.1 = 0 Then
    pinC.4 = 0
  Else
    pinC.4 = 1
  End If
  pause 2000
    
  pinC.4 = pinC.1
  pause 2000  
goto main
Any of the three methods work fine in a chip.
 

Technical

Technical Support
Staff member
You set pin C.1 as an output (high C.1) then try to use it as an input (if pinC.1=...)?
 

lewisg

Senior Member
Also see Hippy's post yesterday to you in a different thread
http://www.picaxeforum.co.uk/showthread.php?18225-Pin-Naming-Conventions/page3
Thanks for your reply.

All three methods came from a previous Hippy post referenced in the above thread, http://www.picaxeforum.co.uk/showthread.php?17490-Picaxe-20M-Syntax Since this runs fine in chip I figured it was different enough to be it's own thread.

If this is not the way to do this then what is? Code please.

I beg to differ on the concept of "input pin" since I'm not trying to detect the state of an external device. I'm merely trying to get the status of a pin set by programming and use that in a conditional. I don't know enough to say if there is a difference at a low level but the difference is profound at the hook stuff up and make it work level.
 
Last edited:

MartinM57

Moderator
I'm merely trying to get the status of a pin set by programming and use that in a conditional
You have two choices:
- remember the state yourself by using another variable
- use the outpinsC variable that specifically exists to do what you want...

...and then move on to the next challenge :)
 

Technical

Technical Support
Staff member
I beg to differ on the concept of "input pin" since I'm not trying to detect the state of an external device. I'm merely trying to get the status of a pin set by programming and use that in a conditional. I don't know enough to say if there is a difference at a low level but the difference is profound at the hook stuff up and make it work level.
They are very different. When a pin is configured as an output it is 'internally electrical different' to a pin configured as an input (e.g. FET drivers are enabled in output state but disabled in input state). Therefore when a pin is configured as an output you can't read the normal 'input circuitry' reliably - as effectively you have a completely different electrical circuit 'inside' the chip.
 
Last edited:
Top