- Thu Apr 28, 2005 6:44 am
#4564
[edit] I posted this in wrong section, can someone move it to PICs?
I am trying to turn on PORTA when RB0 (bit0 of PORTB) gets input. But PORTA doesn't turn on when I give +5V to RB0.
I am trying to turn on PORTA when RB0 (bit0 of PORTB) gets input. But PORTA doesn't turn on when I give +5V to RB0.
Code: Select all
#include <p18f1320.inc>
__config _CONFIG1H, 0x04; external oscillator
__config _CONFIG2L, 0x00; PWRT and brown out off
__config _CONFIG2H, 0x00; PWRT and brown out off
__config _CONFIG4L, 0x80
main
; all outputs
CLRF TRISA; outputs
SETF TRISB;inputs
; init
CLRF PORTA
CLRF PORTB
checkagain
MOVLW b'00000001'; bit 0
ANDWF PORTB, 0
BZ checkagain
SETF PORTA,0; turn on port a
GOTO checkagain
END
Last edited by RITZ on Thu Apr 28, 2005 9:11 am, edited 2 times in total.