View previous topic :: View next topic |
Author |
Message |
young
Joined: 24 Jun 2004 Posts: 285
|
How to use MCLR pin? |
Posted: Wed Jul 28, 2004 9:48 am |
|
|
every chip has a MCLR pin, what this pin used for, can I use it a general I/O to receive and output data, if it is possible, how to check if MCLR is on/off and how to send high and low to it? |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Wed Jul 28, 2004 9:55 am |
|
|
The MCLR pin is used as an external reset to the PIC. Some PIC's offer the option to use this pin as a regular I/O, usually programmed with the #fuses statement. The PIC, itself, does not 'drive' the MCLR pin but is pulled Low whenever the circuit needs to reset the PIC like some kind of supervisor circuit. The PIC can, however, reset itself via a Watchdog in case the proram 'hangs'. Read the data sheet to see if the MCLR pin can be used as a general I/O. You can, also, enable or disable the MCLR input on many PIC's.
Ronald |
|
|
young
Joined: 24 Jun 2004 Posts: 285
|
|
Posted: Wed Jul 28, 2004 10:00 am |
|
|
for 12f675 I found out that GP3 is also the MCLR pin, how to define it as general i/0 and how to define it as MCLR using #fuses as you suggested?
Thank you |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Jul 28, 2004 12:22 pm |
|
|
young wrote: | for 12f675 I found out that GP3 is also the MCLR pin, how to define it as general i/0 and how to define it as MCLR using #fuses as you suggested?
Thank you |
Look at the CCS header file for the 12F675 (in your \Devices directory). All the fuse settings are defined there. You may also need the chip datasheet from Microchip to understand it. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Wed Jul 28, 2004 12:48 pm |
|
|
In your CCS New Project Wizard, un-selecting the MCLR option will put a NOMCLR in your #fuses statement. Try this and then click on the 'View Code Generated' tab to see what is generated for the .h file. These are the 'fuses' that will be programmed when you 'burn' the code into your PIC. The data sheet looks like the GP3 pin is enabled to be an Input-only when the MCLR is disabled. |
|
|
Guest
|
|
Posted: Wed Jul 28, 2004 1:02 pm |
|
|
Thank you for your great help!!! I am kinds of like a blind person walking on the street need all detailed instructions. I appreciated. |
|
|
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
MCLR |
Posted: Sat Jul 31, 2004 11:03 pm |
|
|
Hello,
I found that the PIC never functioned when the MCLR was left floating, but when I tied it to +5 Volt it became alright.
Is it OK to keep MCLR high permanently??
cheers
arun |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Mon Aug 02, 2004 9:06 am |
|
|
Yes, you can keep MCLR tied 'high' permanently. Never leave it just 'floating' as it will cause you problems. MCLR would be used if you wanted to have an external circuit act as a supervisor and reset the PIC in case things went hay-wire. I simply pull mine high, through a pull-up resistor, and just leave it there. I do, however, use the MCLR input while I'm debugging my programs so that I can reset it without cycling power all of the time.
Ronald |
|
|
|