Well, I got a programmer and a few 16f628a's and I've been playing around with them for a couple days now. I've been making LED's blink, small motors move, and made a small piezo scream which scared the cat. All in all, with the exception of a few hours of frustration trying to get a program downloaded to the pic, it's been a lot of fun.
But now I have run into a snag, I'm trying to get my pic to react to input and it's just not working. I'm not sure if it's a programming problem or a circuit problem.
Here's the code. All I'm trying to do is get a motor to start spinning as soon as power is applied and then stop when a button is pressed.
Code:
main
bsf STATUS,RP0
movlw b'010'
movwf TRISA ;this should make pin 18 an input, correct?
bcf STATUS,RP0
LOOP
movlw b'101'
movwf PORTA ;this seems to work, pin 17 and 1 become outputs
btfss PORTA,1 ;should send the program to hold when pin 18 gets voltage
goto LOOP
goto HOLD
HOLD
movlw b'000'
movwf PORTA ;turns off pins 17 and 1
goto HOLD ;should just keep it looping forever, motor should stay off
If it looks like this should work, why can't I get the motor to shut down? All I should need to do is send a few volts to pin 18?
Thanks for any help.