question about programming PIC 16F84

Status
Not open for further replies.

TronicBrain

Member
Hi every one…
I have a question about programming PIC 16F84

Setup ports are as following ..
RA0 to RA4 an input pins
RB0 to RB4 an output pins
Every RAx is an on/off input switch for the output RBx
When RAx goes high and then low the RBx is high and repeats again to get low.
How can I targeting every bit of portb as on/off switch ??
The instruction comf is targeting a full bite While I only have four Bit instructions.

Thank you All
 
Here's a sample code:
Code:
PORT_SAVE EQU   0Ch
TEMP_SAVE EQU	0Dh

	ORG     0
START:
	MOVLW	B'00011111'
	TRIS 	PORTA
	MOVLW	B'00000000'
	TRIS 	PORTB
	CLRF 	PORTB
	COMF 	PORTA,W
	MOVWF	PORT_SAVE
LOOP:
	COMF 	PORT_SAVE,W
	MOVWF	TEMP_SAVE
	COMF 	PORTA,W
	MOVWF	PORT_SAVE  	
	ANDWF	TEMP_SAVE,W	; DETECT FALLING EDGE
	ANDLW	B'00011111'	; MASK OUT UNUSED BITS
	XORWF	PORTB,F		; TOGGLE CORRESPONDING PORTB BITS
;
	GOTO 	LOOP
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…