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 support@ccsinfo.com

how to set 12f675 MCLR pin?

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



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

how to set 12f675 MCLR pin?
PostPosted: Thu Jun 02, 2005 11:14 am     Reply with quote

I want to use the PIN_A3 as a reset pin (12f675), so that when I trigger this pin, the chip will reset and start again, How can I do it< I did not find the related command in ccs c. thank you
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 02, 2005 11:35 am     Reply with quote

This question was answered on May 15th.
Somehow I suspect that you are all in the same class at school.
http://www.ccsinfo.com/forum/viewtopic.php?t=23008&highlight=mclr+nomclr
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

PostPosted: Thu Jun 02, 2005 12:04 pm     Reply with quote

I used MCLR for the other chips, it works fine, when I used for the 12f675, my other function like external interrupt stop working, any possible reasons?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 02, 2005 12:28 pm     Reply with quote

Post a small complete program that shows the problem.
Be sure to post the #fuses statement, #use statements, etc.
Also post your version of the CCS compiler.
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

PostPosted: Thu Jun 02, 2005 12:40 pm     Reply with quote

thank you, here is the whole program:

Code:

#if defined(__PCM__)
#include <12f675.h>
#fuses INTRC_IO,NOWDT,NOPROTECT,PUT,MCLR
#use delay(clock=4000000)
#use rs232(baud=9600, parity=N, xmit=PIN_A0,INVERT)

void LCDSetGeometry();
void LCDReset();
void LCDinit();
void LCDSetBackLight(int8 backlit);
void LCDSetContrast(int8 contr);
void LCDClrScr();
void LCDNewLine();
void LCDCR();
void LCDTab();
void LCDVerTab();
void LCDBackSpaces(int8 bspa);
void LCDSetTab(int8 Stab);
void LCDSetCursorPos(int8 x, int8 y);
void LCDClrLine(int8 x, int8 y);
void LCDSetCursorStyle();
void LCDOnOff(int8 onoff);

int16 count;

#INT_ext
void ext_isr()
{

count++;

}


void main()
{
  setup_adc_ports (NO_ANALOGS);
  setup_comparator(NC_NC_NC_NC);  //setup_comparators(NC_NC_NC_NC); no "s"
  LCDinit();
  LCDClrScr();
  LCDSetCursorPos(0,0);
  puts("*Pulse counting*");
  count=0;
  EXT_INT_EDGE(L_TO_H);
  enable_interrupts(INT_ext);
  enable_interrupts(GLOBAL);

 while(1)
{

  if(input(PIN_A1))
    count=0;
  LCDSetCursorPos(1,1);
  printf("Num=%lu   ",count);
  }

}

void LCDSetGeometry()
{
   putc(15);
   delay_ms(10);
   putc(16);
      delay_ms(10);
   putc(0x80);
      delay_ms(10);
   putc(0xc0);
      delay_ms(10);
   putc(0x80);
      delay_ms(10);
   putc(0x80);
      delay_ms(10);
}

void LCDReset()
{
   putc(14);
   delay_ms(1000);

}
void LCDinit()
{
   // Set LCD Geometry
   LCDSetGeometry();
   // LCDReset
   LCDReset();
}


void LCDSetBackLight(int8 backlit)
{
   putc(20);
   delay_ms(10);
   putc(backlit);
}

void LCDSetContrast(int8 contr)
{
   putc(19);
   delay_ms(10);
   putc(contr);
}

void LCDClrScr()
{
   putc(12);
   delay_ms(10);
}

void LCDNewLine()
{
   putc(10);
   delay_ms(10);
}

void LCDCR()
{
   putc(10);
}

void LCDTab()
{
   putc(9);
}

void LCDVerTab()
{
   putc(11);
}

void LCDBackSpaces(int8 bspa)
{
   int8 i;
   for(i=1;i<bspa;i++)
      putc(8);
}

void LCDSetTab(int8 Stab)
{
   stab=(stab^0xFF)+1;
   putc(16);
   delay_ms(10);
   putc(stab);
}

void LCDSetCursorPos(int8 x, int8 y)
{
   putc(17);
//   delay_ms(10);
   putc(y);
 //  delay_ms(10);
   putc(x);
 //  delay_ms(100);  //888888// removed this increase speed
}

void LCDClrLine(int8 x, int8 y)
{
   int8 nn;
   lcdSetCursorPos(0,0);
   for(nn=0;nn<<15;nn++)
   putc(' ');

   LCDSetCursorPos(0,0);
}

void LCDSetCursorStyle()
{

}

void LCDOnOff(int8 onoff)
{
if (onoff==0)
   {
   putc(21);
   putc(0x08);
   }
if (onoff==1)
   {
   putc(21);
   putc(0x0c);
   }
}

Guest








PostPosted: Thu Jun 02, 2005 1:08 pm     Reply with quote

PCM programmer wrote:
Post a small complete program that shows the problem.
Be sure to post the #fuses statement, #use statements, etc.
Also post your version of the CCS compiler.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 02, 2005 1:11 pm     Reply with quote

I don't know who posted that, but yes, I was wishing that the program
was a bit smaller and that he had posted his compiler version. Mr. Green
languer



Joined: 09 Jan 2004
Posts: 144
Location: USA

View user's profile Send private message

PostPosted: Thu Jun 02, 2005 2:01 pm     Reply with quote

You say the posted (not small) program works with NOMCLR but does not with MCLR.

What is MCLR tied to (not floating I hope)?

What is the source for the interrupt (EXT/GP2)?

Hopefully you understand where I am headed with this (Pulse into GP2 -> MCLR on GP3 -> bad things happen if not properly isolated).
Guest








PostPosted: Thu Jun 02, 2005 2:20 pm     Reply with quote

the interrupt is GP2, the source of the interrupt is a square signal. the MCLR is not floating, it is connected with +5V.
DragonPIC



Joined: 11 Nov 2003
Posts: 118

View user's profile Send private message

PostPosted: Thu Jun 02, 2005 2:26 pm     Reply with quote

#if defined(__PCM__)
#include <12f675.h>


I compile ok first time. Played around a little. Compiled again and error = "Missing #ENDIF". Probably not your problem, but an error.
_________________
-Matt
DragonPIC



Joined: 11 Nov 2003
Posts: 118

View user's profile Send private message

PostPosted: Thu Jun 02, 2005 3:00 pm     Reply with quote

My compiler ver 3.178 compiles ok and I can see in the cof file that MCLRE bit changed correctly with MCLR and NOMCLR.
_________________
-Matt
DragonPIC



Joined: 11 Nov 2003
Posts: 118

View user's profile Send private message

PostPosted: Thu Jun 02, 2005 3:18 pm     Reply with quote

try using INT_RA0, INT_RA1, ect for interrupts. I see them defined in the device library file.
_________________
-Matt
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