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

12F629 clock-out not working

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







12F629 clock-out not working
PostPosted: Tue Dec 07, 2004 6:39 pm     Reply with quote

No clock out and needless to say the LED doesn't flash either.

Any ideas would be appreciated.

PCW Compiler version 3.139


#include <12F629.h>
#include <stdlib.h>
#define BUZZER PIN_A1

#fuses INTRC, NOWDT,NOCPD,NOPROTECT,MCLR, NOPUT,NOBROWNOUT,NOSTVREN
#use delay(clock=4000000)
#byte CMCON=0X19
main()
{
set_tris_a(0);
setup_comparator(nc_nc_nc_nc);
CMCON=7;

while(1){
output_high(BUZZER);
delay_ms(200);
output_low(BUZZER);
delay_ms(200);
}
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Dec 07, 2004 9:41 pm     Reply with quote

When I get into the company tomorrow, I'll install your version of
the compiler and test it with a 12F629. That is, if you haven't
solved the problem before then.
languer



Joined: 09 Jan 2004
Posts: 144
Location: USA

View user's profile Send private message

PostPosted: Wed Dec 08, 2004 12:15 am     Reply with quote

I could not get your program to compile. The fuse statement NOSTVREN, does not relate to anything. The following code does compile and works (on 3.164 and 3.184):

Code:

/*12F629 clock-out not working*/
#include <12F629.h>
//#include <stdlib.h>
#define BUZZER PIN_A1

//#fuses INTRC, NOWDT,NOCPD,NOPROTECT,MCLR, NOPUT,NOBROWNOUT,NOSTVREN
#fuses INTRC_IO,NOWDT,NOPUT,NOPROTECT,NOCPD,NOMCLR,NOBROWNOUT
#use delay(clock=4000000)
#byte CMCON=0X19
main()
{
set_tris_a(0);
setup_comparator(nc_nc_nc_nc);
CMCON=7;

while(1){
output_high(BUZZER);
//delay_ms(200);
delay_ms(1000);
output_low(BUZZER);
//delay_ms(200);
delay_ms(1000);
}
}
johnl



Joined: 30 Sep 2003
Posts: 120

View user's profile Send private message

PostPosted: Wed Dec 08, 2004 12:00 pm     Reply with quote

languer,

I tried your code and still no LED output.

Could you please send me the HEX file?

If that works I can conclude it's my compiler version, unless PCM Progammer tells me it's not after he tries it.

Thanks much.

Johnl

PS Not sure what the problem with the NOSTVREN fuse is. It is listed in the header file. Maybe it was removed in your later compiler version(?)

//////// Standard Header file for the PIC12F629 device ////////////////
#device PIC12F629
#nolist
//////// Program memory: 1024x14 Data RAM: 64 Stack: 8
//////// I/O: 6 Analog Pins: 0
//////// Data EEPROM: 128
//////// C Scratch area: 20 ID Location: 2000
//////// Oscilator Calibration Address: 90
//////// Fuses: LP,XT,INTRC,HS,NOWDT,WDT,CPD,NOCPD,PROTECT,NOPROTECT,NOMCLR
//////// Fuses: MCLR,PUT,NOPUT,RC,EC,RC_IO,INTRC_IO,BROWNOUT,NOBROWNOUT
//////// Fuses: NOSTVREN,NOSTVREN
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Dec 08, 2004 12:19 pm     Reply with quote

Quote:
PS Not sure what the problem with the NOSTVREN fuse is. It is listed in the header file. Maybe it was removed in your later compiler version(?)

STVREN stands for: Stack Full/Underflow Reset Enable bit
This bit is not available in the PIC12F629 hardware so it must be removed from your header file in a later version.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 08, 2004 1:00 pm     Reply with quote

I removed NOSTVREN from the end of your #fuses statement
and compiled your program with PCM vs. 3.139.

It works OK.

Here are the signals on each pin:

Pin 7 -- High level
Pin 6 -- 2.5 Hz square wave
Pin 5 -- Low level
Pin 3 -- 1 MHz square wave
Pin 2 -- High level

I wonder what programmer you're using ? Is it possible that
you have accidently erased the Oscillator Calibration value at
address 0x3FF ? To check this, read the chip, and then view
the Program Memory. At the last address in the chip, you should
see something like this:

Code:

Address    Opcode        Disassembly
3FFF        34B4           RETLW 0xB4


The returned value might be different than 0xB4. But if you see
the following opcode, then you've erased the OSCCAL value.
Code:

Address    Opcode        Disassembly
3FFF        3FFF            ADDLW 0xFF
Johnl1
Guest







PostPosted: Wed Dec 08, 2004 9:46 pm     Reply with quote

PCM Programmer,

When I read the chip, I did see the oscillator calibration value there, but still the chip did not work. But when I switched from my Pro Mate II programmer to the ICD2, the chip worked.

The only thing different since the last time I programmed 'F629s is a newer version of MPLAB.

So for now I can get the job done, although with serial programming, I cannot seem to use the MCLR pin as an input (MPLAB gives an error message if the NOMCLR fuse is set.)

Many thanks to you and the others who helped.

Johnl
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