S Suraj143 Active Member Jan 8, 2008 #1 RB7 is multiplexed. In the ISR for every 500ms the RB7 toggles (on/off). What I need is to turn on /off (toggle) the LED1.In my coding both the LEDs toggle.I don’t need to toggle both I need only LED1. Please help me to solve it. Thanks Code: MTPX bsf PORTA,0 ;turn on LED0 movf M1,W ;get the jump value call Delay bsf PORTA,1 ;turn on LED1 movf H1,W ;get the jump value call Table btfsc PORTB,7 iorlw b'10000000' movwf PORTB call Delay1 goto MTPX Delay call Table btfsc PORTB,7 ;has the bit7 is set? iorlw b'10000000' ;yes,then keep the bit7 show movwf PORTB Delay1 decfsz Del,F goto $-1 clrf PORTA ;clrf PORTA movlw b'10000000' ;clrf PORTB without harming bit7 andwf PORTB,F return Attachments Share.JPG 5.1 KB · Views: 147 Last edited: Jan 8, 2008
RB7 is multiplexed. In the ISR for every 500ms the RB7 toggles (on/off). What I need is to turn on /off (toggle) the LED1.In my coding both the LEDs toggle.I don’t need to toggle both I need only LED1. Please help me to solve it. Thanks Code: MTPX bsf PORTA,0 ;turn on LED0 movf M1,W ;get the jump value call Delay bsf PORTA,1 ;turn on LED1 movf H1,W ;get the jump value call Table btfsc PORTB,7 iorlw b'10000000' movwf PORTB call Delay1 goto MTPX Delay call Table btfsc PORTB,7 ;has the bit7 is set? iorlw b'10000000' ;yes,then keep the bit7 show movwf PORTB Delay1 decfsz Del,F goto $-1 clrf PORTA ;clrf PORTA movlw b'10000000' ;clrf PORTB without harming bit7 andwf PORTB,F return
S Suraj143 Active Member Jan 8, 2008 #2 Forgot to tell the Two LEDs from two SSD.Thats why i multiplex them. The coding works nicely but its toggling the both LEDs thats the problem.
Forgot to tell the Two LEDs from two SSD.Thats why i multiplex them. The coding works nicely but its toggling the both LEDs thats the problem.
Gayan Soyza Active Member Jan 8, 2008 #3 You can do this way. Code: MTPX bsf PORTA,0 ;turn on LED0 movf M1,W ;get the jump value call Table [B][COLOR="Red"]andlw b'01111111' ;ignore the RB7 movwf PORTB call Delay1[/COLOR][/B] bsf PORTA,1 ;turn on LED1 movf H1,W ;get the jump value [B][COLOR="Red"]call Delay [/COLOR][/B] goto MTPX
You can do this way. Code: MTPX bsf PORTA,0 ;turn on LED0 movf M1,W ;get the jump value call Table [B][COLOR="Red"]andlw b'01111111' ;ignore the RB7 movwf PORTB call Delay1[/COLOR][/B] bsf PORTA,1 ;turn on LED1 movf H1,W ;get the jump value [B][COLOR="Red"]call Delay [/COLOR][/B] goto MTPX
F five0 New Member Jan 9, 2008 #4 Suraj143 said: What I need is to turn on /off (toggle) the LED1.In my coding both the LEDs toggle.I don’t need to toggle both I need only LED1. Click to expand... why not simple turn LED0 off , replace first line with bcf PORTA,0
Suraj143 said: What I need is to turn on /off (toggle) the LED1.In my coding both the LEDs toggle.I don’t need to toggle both I need only LED1. Click to expand... why not simple turn LED0 off , replace first line with bcf PORTA,0
S Suraj143 Active Member Jan 9, 2008 #5 five0 said: why not simple turn LED0 off , replace first line with bcf PORTA,0 Click to expand... Hi it is because the LED is a Segment in the seven segment display.If I turn it off the whole segment is turning off.Thats y. The Gayans method worked & I added some more to that.
five0 said: why not simple turn LED0 off , replace first line with bcf PORTA,0 Click to expand... Hi it is because the LED is a Segment in the seven segment display.If I turn it off the whole segment is turning off.Thats y. The Gayans method worked & I added some more to that.