Hello
I have a problem with my 16F627 (or with my program). I have done a smal program to drive a stepper motor. The program workes fine until I what to start/stop the motor useing Porta.1 as input. My program code lookes like this:
DEFINE OSC 4
'Port A och B
TRISA = 255
TRISB = 0
'Variabler
Rb0 VAR PORTB.0
Rb1 VAR PORTB.1
Rb2 VAR PORTB.2
Rb3 VAR PORTB.3
Delay1 VAR BYTE
Delay2 VAR BYTE
Delay1 = 10
Delay2 = 1000
'Programkod
Program:
IF PORTA.1 = 1 Then st2
IF PORTA.1 = 0 Then st1
GoTo Program
st1:
Low Rb0
High Rb1
Low Rb2
High Rb3
Pause delay1
Low Rb0
High Rb1
High Rb2
Low Rb3
Pause delay1
High Rb0
Low Rb1
High Rb2
Low Rb3
Pause delay1
High Rb0
Low Rb1
Low Rb2
High Rb3
Pause delay1
GoTo Program
st2:
Low Rb0
Low Rb1
Low Rb2
Low Rb3
Pause delay2
GoTo Program
If I use Portb.4 as the input instead of porta.1 it workes just fine. The motor stopes for one second (delay2) when I push the button connected to pin 10 (portb.4) but when I use porta.1 (pin 18) the motor doesn't stop.
Does anyone know what I am doing wrong?
\Jonas
http://www.geocities.com/jcee324/eindex.htm
Bookmarks