View previous topic :: View next topic |
Author |
Message |
Spradecom
Joined: 01 Jun 2011 Posts: 19 Location: INDIA
|
HOW TO USE MCLR pin as GPIO pin? |
Posted: Tue Oct 04, 2011 3:13 am |
|
|
I am using 12F615 for my application I want to toggle PIN 4(MCLR) pin.I have used following FUSES but does not work,Can any help me to solve this Problem.
#include <12F615.h>
#device adc=10
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOPROTECT //Code not protected from reading
#FUSES IOSC4 //INTOSC speed 4 MHz
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOPUT //No Power Up Timer
#use delay(clock=4000000) |
|
|
Geps
Joined: 05 Jul 2010 Posts: 129
|
|
Posted: Tue Oct 04, 2011 3:29 am |
|
|
Have you successfully toggled another pin on the device?
At least that way you know you've got a valid configuration. |
|
|
Spradecom
Joined: 01 Jun 2011 Posts: 19 Location: INDIA
|
|
Posted: Tue Oct 04, 2011 3:44 am |
|
|
Thanks
for your reply ya i have toggle successfully another PIN but one of pin is MCLR(RESET) pin how can i toggle that pin. I'm new to CCS compiler I have only know about 8051.
Geps wrote: | Have you successfully toggled another pin on the device?
At least that way you know you've got a valid configuration. |
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Tue Oct 04, 2011 3:52 am |
|
|
You can't.
Nothing to do with the CCS compiler. Read the _data sheet_. The MCLR pin is _not_ an I/O pin on the 12F615, it _only_ supports input. I have answered this in another thread you started 'how to complement a single bit or pin'. The answer remains the same.
You also have a third thread 'low current consumption problem', asking the same question. Repeating the question over and over, _won't_ change the answer. The chip's hardware does not support output on this pin.
This is common to just about all of the 8pin chips (possibly all, I can't think of one that allows output on this pin), and is because the pin is the programming pin for the chip, so has to be able to be taken to a voltage above the normal supply rail. Hence it cannot have a FET to pull the pin up to Vdd, since this would become reverse biased when the pin is used for programming.
Best Wishes |
|
|
Spradecom
Joined: 01 Jun 2011 Posts: 19 Location: INDIA
|
Problem In Using MCLR PIN as Input |
Posted: Sat Oct 08, 2011 1:01 am |
|
|
As posted ealiar I have used MCLR pin of 12F615 as digital input. But i face one problem that after sometime these pin reset the device is it possible? I had go through datasheet but my doubt not be clear. I had used NOMCLR fuse to used MCLR pin For GP3 as input. Can any help me to clear this doubt.
Code: |
if(INPUT(PIN_A3))
{
duty=1015;
}
else
{
duty=205;
} |
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Sat Oct 08, 2011 2:02 am |
|
|
Yes.
If the voltage on this pin goes more than perhaps 0.5v outside the range of the supply rails, it can trigger a reset.
Unlike the other I/O pins, this pin does not have trap diodes to prevent it going above the supply rail (because of it's programming use). If the input goes above the supply, this reverse biases the FET used to connect/disconnect it from the internal reset circuitry, and sometimes a reset can be triggered. This has been documented by Microchip in the past, with the comment, that _you_ need to ensure that signals attached cannot do this (classic way would be to have your own external trap diode, which either has enough resistance after it, so programming can still occur, or is disconnected when programming.
Suggests your 'digital input', is potentially noisy.
Best Wishes |
|
|
Spradecom
Joined: 01 Jun 2011 Posts: 19 Location: INDIA
|
|
Posted: Sat Oct 08, 2011 4:39 am |
|
|
Thanks sir my for your valuable reply. My Controller handling 1 Analog input, 1 digital input and 3 digital output and 1 PWM output no other pin free. I think this problem solve by replacing controller with more than 8 pin.
Ttelmah wrote: | Yes.
If the voltage on this pin goes more than perhaps 0.5v outside the range of the supply rails, it can trigger a reset.
Unlike the other I/O pins, this pin does not have trap diodes to prevent it going above the supply rail (because of it's programming use). If the input goes above the supply, this reverse biases the FET used to connect/disconnect it from the internal reset circuitry, and sometimes a reset can be triggered. This has been documented by Microchip in the past, with the comment, that _you_ need to ensure that signals attached cannot do this (classic way would be to have your own external trap diode, which either has enough resistance after it, so programming can still occur, or is disconnected when programming.
Suggests your 'digital input', is potentially noisy.
Best Wishes |
|
|
|
|