CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

HOW TO USE MCLR pin as GPIO pin?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Spradecom



Joined: 01 Jun 2011
Posts: 19
Location: INDIA

View user's profile Send private message MSN Messenger

HOW TO USE MCLR pin as GPIO pin?
PostPosted: Tue Oct 04, 2011 3:13 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Oct 04, 2011 3:29 am     Reply with quote

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

View user's profile Send private message MSN Messenger

PostPosted: Tue Oct 04, 2011 3:44 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Oct 04, 2011 3:52 am     Reply with quote

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

View user's profile Send private message MSN Messenger

Problem In Using MCLR PIN as Input
PostPosted: Sat Oct 08, 2011 1:01 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Oct 08, 2011 2:02 am     Reply with quote

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

View user's profile Send private message MSN Messenger

PostPosted: Sat Oct 08, 2011 4:39 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group