16F628 MCLR as an output?

Status
Not open for further replies.

Andy1845c

Active Member
I just got the 16F628s I ordered, and I am trying to come up with a board that will allow me to control 8 LEDs indevidually. I want to be able to use the Inchworm programmer with it and make differnt flash patterns.

I see that Nigel has an 8 LED board in his lessons, but it uses MCLR (RA5) as an output. From searching the forum, it dosn't look like that will work with the inchworm. Can someone verify that thinking?

If RA5 needs to be left as MCLR, would I be best off skipping it and using RA6 and 7 and a B port for the remaining LED? Or would it be best to just use RA0-4 and use 3 of the B ports or does this not really matter?
 
RA5 is input only and so can't be used to power an LED. I'd just use the bottom 4 bits of each port.

Mike.
 
Would it be okay to use RA 1, 0, 7, 6 and RB 7, 6, 5 4? That way all would be on one side of my PIC. I'm mostly concerned about controlling patterns when I have to worry about 2 seperate ports. If I want the center 2 to light together, I will have one on each port to worry about. Maybe thats no problem, but i'm new to everything PIC. But am do feel like I am learning thanks to everyone here
 
Your only problem then would be the fact that the ICD2 uses RB6 and RB7.

Mike.
 
BTW, if you use the bottom 4 bits from each port then writing the value becomes easier.

You would only set the lower pins to output by doing,
Code:
	bsf	STATUS,RP0
	movlw	0xf0
	movwf	TRISA
	movwf	TRISB
	bcf	STATUS,RP0

And if you have the value you want output in a variable called LEDs, then you can do,
Code:
	movfw	LEDs
	movwf	PORTA
	swapf	LEDs,W
	movwf	PORTB
to write the 8 bits to the port.

Mike.
 
Shoot, forgot about that with RB 6 and 7.

When you say bottom bits, what ones are you referring to? 1-4 or 0-3? Sorry if thats a dumb question
 
It would have to be 0-3 if you want to use the swap instruction.

Mike.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…