Hello, I have searched here and elsewhere for the answer to my question but I cannot seem to find it. I am tyrying to make an 8 bit LED bar graph scroll to the left. But, it only is to shift one time left before returning to main. LED_Location is a variable I have set to keep track of my LED position. Once the count in LED_Location gets to d'8' I have it reseting the count to zero since my leds are 0-7.
It currently is working like a counter, my LED output on PORTC is from what I understand taking the number from LED_Location and representing it in binary dislpay.
What I am trying to accomplish is only one LED is on at a time, and if my value from LED_Location is 1, then I need only PORTC bit1 on, if my value from LED_Location is 3, I need only PORTC bit 3. Right now if LED_Location is 3, im getting PORTC bit1 and bit2 lit up for the b'3' value....
Heres what I have
Left
; Shifts LEDs left one position, to scroll left led location output shifts from 'd' value
; 0 and shifts upward, ie 0,1,2....7, then resets to 0
clrf PORTC ; Clears previous LED
incf LED_Location,f ; adds 1 to previous LED value to scroll left
btfsc LED_Location,3 ; tests if decimal value is 8,there is no led8
clrf LED_Location ; if decimal value is 8 Led location is reset to zero
movf LED_Location,W
movwf PORTC ; led is now lit up depending on value
return
My problem is the movwf PORTC, I need to bsf PORTC (what ever bit is represented by the value of LED_Location)
Any suggestions???
It currently is working like a counter, my LED output on PORTC is from what I understand taking the number from LED_Location and representing it in binary dislpay.
What I am trying to accomplish is only one LED is on at a time, and if my value from LED_Location is 1, then I need only PORTC bit1 on, if my value from LED_Location is 3, I need only PORTC bit 3. Right now if LED_Location is 3, im getting PORTC bit1 and bit2 lit up for the b'3' value....
Heres what I have
Left
; Shifts LEDs left one position, to scroll left led location output shifts from 'd' value
; 0 and shifts upward, ie 0,1,2....7, then resets to 0
clrf PORTC ; Clears previous LED
incf LED_Location,f ; adds 1 to previous LED value to scroll left
btfsc LED_Location,3 ; tests if decimal value is 8,there is no led8
clrf LED_Location ; if decimal value is 8 Led location is reset to zero
movf LED_Location,W
movwf PORTC ; led is now lit up depending on value
return
My problem is the movwf PORTC, I need to bsf PORTC (what ever bit is represented by the value of LED_Location)
Any suggestions???
Last edited: