Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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
 
Thank you very much...

And I will try to understand it :D

Thanx again :)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top