I'm learning the PIC16F690 and I'm trying to program it to do a simple operation, move over one led each time the single button is pressed and then reset. I'm not asking for code, just if I can bounce ideas of how to implement this off someone who can maybe offer some hints because I don't yet have the hang of coding it, even though I have an idea of how I want the code to be structured.

So I've been fooling around with code for the PIC and still having trouble, I am trying to get it load the lights in the pattern 1000,0100,0010,0001 where it transitions to the next output after each press of the switch and then resets on the next button press, but instead it seems to be blinking 1000 (not certain might be 0001) and then displays 1111. I think there is something wrong with the btfsc command and an internet search revealed I'm not the only one who has this problem. Anyone know how to fix this?

first:
        movlw   0x08            ; 1000
        movwf   PORTC       
        btfsc   PORTA,SWITCH    
        goto    second
second:
        movlw   0x04            ; 0100
        movwf   PORTC           
        btfsc   PORTA,SWITCH    
        goto    third
third:
        movlw   0x02            ; 0010
        movwf   PORTC           
        btfsc   PORTA,SWITCH    
        goto    fourth
fourth:
        movlw   0x01            ; 0001
        movwf   PORTC           
        btfsc   PORTA,SWITCH    
        goto    first

Edited 4 Years Ago by Goldfinch

This article has been dead for over six months. Start a new discussion instead.