Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 12th March 2007, 02:12 AM   (permalink)
Default 16F628 MCLR as an output?

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?
Andy1845c is offline  
Old 12th March 2007, 02:30 AM   (permalink)
Default

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.
Pommie is online now  
Old 12th March 2007, 02:52 AM   (permalink)
Default

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
Andy1845c is offline  
Old 12th March 2007, 03:06 AM   (permalink)
Default

Your only problem then would be the fact that the ICD2 uses RB6 and RB7.

Mike.
Pommie is online now  
Old 12th March 2007, 03:15 AM   (permalink)
Default

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.
Pommie is online now  
Old 12th March 2007, 03:30 AM   (permalink)
Default

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
Andy1845c is offline  
Old 12th March 2007, 03:39 AM   (permalink)
Default

It would have to be 0-3 if you want to use the swap instruction.

Mike.
Pommie is online now  
Old 12th March 2007, 03:48 AM   (permalink)
Default

Thank you. I will give it a try.
Andy1845c is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
uuffff how doess this stupid ting work lol cyprio7 General Electronics Chat 7 9th October 2005 07:56 PM
I am not getting ripple voltage at the output dar2525 General Electronics Chat 3 14th July 2005 03:21 PM
Function Generator output driver evandude General Electronics Chat 6 31st January 2005 08:49 PM
Effects stephenpic Micro Controllers 6 19th January 2004 12:57 PM



All times are GMT. The time now is 07:14 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker