18M2 serial input as an input, problem?

sghioto

Senior Member
As the title of this post suggest I'm having problems configuring the serial input as pinC.4 It basically does not work correctly as a digital input!
I have tried the attached code on two different chips with the same problem.
Can someone out there test this simple circuit and code to verify?
I have verified that the circuit is wired correctly and YES the download cable is removed during testing.
Using this code the LED will not come on at all.
Code:
                 main: if pinC.4 = 1 then LED_on
                       goto main
               LED_on: high B.0 
                       pause 500
                       low B.0  
                       pause 500
                       high B.0
                       pause 500
                       goto main
Changing the code to:
Code:
                 main: if pinC.4 = 0 then LED_on
                       goto main
               LED_on: high B.0
                       pause 500
                       low B.0
                       pause 500
                       high B.0
                       pause 500
                       goto main
The LED will come on initially and follow the code until pinC.4 goes high, at this juncture the LED operation is delayed.
It seems that some of these operations are trying to initiate a download which could be the cause of the problem.
Thanks to brothermenot for the schematic.

Steve G

 

tarzan

Senior Member
Try "Disconnect".

Code:
#picaxe 18m2

Disconnect

Do

	if pinC.4 = 1 then gosub LED_on

loop
        
LED_on: 

	high B.0 
	pause 500
	low B.0  
	pause 500
	high B.0
	pause 500
	low B.0
		
return
 
Top