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

12F1822 1KHz reset?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mvanvliet



Joined: 02 Jun 2009
Posts: 123
Location: The Netherlands

View user's profile Send private message

12F1822 1KHz reset?
PostPosted: Thu Apr 07, 2011 7:18 am     Reply with quote

I've some strange problems with this processor, maybe it can be solved with a compiler update, but I first want to be sure that it's not a programming fault.

CCS compiler version 4.106

Code:

#FUSES INTRC_IO, NOMCLR, NOCPD, NOWDT, NOBROWNOUT, NOPUT, NOPROTECT, NOFCMEN, NOIESO

//////// Fuses: LP,XT,HS,EC_IO,NOWDT,WDT,CPD,NOCPD,PROTECT,NOPROTECT,NOMCLR
//////// Fuses: MCLR,PUT,NOPUT,INTRC_IO,INTRC,RC_IO,RC,BROWNOUT,NOBROWNOUT
//////// Fuses: BROWNOUT_NOSL,BROWNOUT_SW,IESO,NOIESO,FCMEN,NOFCMEN

#Device ADC=8                                                                   //8 bit
#use delay(clock=4000000)                                                       // Fuses and delay are set, so int osc is set at 4Mhz. MCLR,NOMCLR,PROTECT,NOPROTECT,WDT,NOWDT

#define     REMOTE    PIN_A0                                                    //drukknop                                                   //24VOFF
#define     PUSH_ON   PIN_A5                                                    //Melding geven dat drukknop is ingedrukt

void main()
{
setup_oscillator(OSC_4MHZ);
SETUP_ADC(ADC_OFF);
SETUP_DAC(DAC_OFF);
SETUP_TIMER_0(T0_internal);
SETUP_TIMER_1(T1_DISABLED);
SETUP_CCP1(CCP_OFF);

while(1)
{

output_high(PUSH_ON);

}
}


This is my code.
Stand alone strange things occur.

On pin2 I've got 5V but every ms it's dipping to about 2 volt and then it's back to 5V again.

On pin 3 I've a square waveform, not constantly, maybe a RS-232 or some other output.

On pin 4 I've a 5V output (which is maybe normal because of the MCLR??)

Please help!
Ttelmah



Joined: 11 Mar 2010
Posts: 19561

View user's profile Send private message

PostPosted: Thu Apr 07, 2011 8:29 am     Reply with quote

Look back at your circuitry _carefully_. Something physical is wrong.
Key thing saying this, is your comment that you have a 5v output on pin4. Pin4, is an _input only_ pin on this PIC. Can't be an output, and can't generate 5v. So if you are seeing 5v on here, whatever may be wrong with the code, it says _something_ is wrong with the circuitry.....

Best Wishes
mvanvliet



Joined: 02 Jun 2009
Posts: 123
Location: The Netherlands

View user's profile Send private message

PostPosted: Thu Apr 07, 2011 8:37 am     Reply with quote

Thanks for your answer, but there aren't any physical parts, the processor is running on a 5V power supply with nothing else.

Can't it be an internal pull-up for the MCLR of something?
Ttelmah



Joined: 11 Mar 2010
Posts: 19561

View user's profile Send private message

PostPosted: Thu Apr 07, 2011 9:42 am     Reply with quote

No.
Are you sure you have the power connected to the right pins....
Look for solder blobs or whiskers round the PIC.
There is no pull up transistor on this pin.
The pin cannot pull up...

Best Wishes
mvanvliet



Joined: 02 Jun 2009
Posts: 123
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Apr 08, 2011 1:26 am     Reply with quote

If you look at the datasheet on page 13 it says that there is an internal pull-up on the MCLR pin.

I've tried some things and I know that the problems come from the fuse settings.

These are my fuses:

Code:
#FUSES INTRC_IO, NOMCLR, NOCPD, NOWDT, NOBROWNOUT, NOPUT, NOPROTECT, NOFCMEN, NOIESO


but my listing file shows: 30D4 (0011.0000.1101.0100)

That's very different from what it must be. For example the MCLR, FCMEN, PROTECT and BROWNOUT fuses are wrong set in the listing file. I also miss the fuses of configuration word 2 in my 12F1822.h file.

I think that in the 4.119 version of the compiler these problems are solved.

Is there a possibility to put the right hex value of the fuses in the program instead of:

Code:
#FUSES INTRC_IO, NOMCLR, NOCPD, NOWDT, NOBROWNOUT, NOPUT, NOPROTECT, NOFCMEN, NOIESO
temtronic



Joined: 01 Jul 2010
Posts: 9253
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Apr 08, 2011 5:37 am     Reply with quote

If you're using MPLAB ,you can easily do it from there.
mvanvliet



Joined: 02 Jun 2009
Posts: 123
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Apr 08, 2011 6:14 am     Reply with quote

I'm not using MPLAB, but every time I change my program and reload it also the fuses are set back to the fault values. I'm looking for a #define of #byte where I can put in the hexvalue of my fuses.
temtronic



Joined: 01 Jul 2010
Posts: 9253
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Apr 08, 2011 7:15 am     Reply with quote

Well, sure sounds like whatever programming software you're using to burn the PIC is the problem.

I only use MPLAB but 'assume' others are similar in allowing either the PIC source code or the programming program itself to set the fuses.

Best to consult the manual for your programmer.
mvanvliet



Joined: 02 Jun 2009
Posts: 123
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Apr 12, 2011 6:32 am     Reply with quote

The problem is not the programmer, but the CCS software, the compiler doesn't make the right fuse word.

Does anyone know at which adress the EEPROM starts at this processor? I can't find it.
temtronic



Joined: 01 Jul 2010
Posts: 9253
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Apr 12, 2011 7:27 am     Reply with quote

It's in the datasheet....
Quikscan....
From Chapter 11 of the datasheet...
When interfacing the data memory block, EEDATL
holds the 8-bit data for read/write, and EEADRL holds
the address of the EEDATL location being accessed.
These devices have 256 bytes of data EEPROM with
an address range from 0h to 0FFh.
When accessing the program memory block, the EEDATH:
EEDATL register pair forms a 2-byte word that
holds the 14-bit data for read/write, and the EEADRL
and EEADRH registers form a 2-byte word that holds
the 15-bit address of the program memory location
being read.
The EEPROM data memory allows byte read and write.
An EEPROM byte write automatically erases the location
and writes the new data (erase before write).

Consult Chapter 3 for the addresses..
mvanvliet



Joined: 02 Jun 2009
Posts: 123
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Apr 12, 2011 8:16 am     Reply with quote

Hmmm looks difficult. In the 12F675 I can use #rom 0x2100 = {AAAA} or write_eeprom(0,AAAA) for example, but it seems that that's too simple for this processor.
ckielstra



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

View user's profile Send private message

PostPosted: Tue Apr 12, 2011 9:53 am     Reply with quote

mvanvliet wrote:
I think that in the 4.119 version of the compiler these problems are solved.
Well, then why not do the upgrade?

You might also check if the program chipedit.exe is present in the programs folder of your CCS compiler. This program allows you to modify the compiler's database where all the chip specific details are stored. Chipedit is not supplied with all compiler versions, I believe only with PCWH.
dbotkin



Joined: 08 Sep 2003
Posts: 197
Location: Omaha NE USA

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Apr 12, 2011 10:49 am     Reply with quote

I would not encourage anyone to use chipedit. I have tried it a couple of times to make VERY minor changes when chips were not correctly defined on CCS, and each time ended up with a completely non-functional compiler and an email to CCS support. Maybe it's just me.

Your best bet would be to upgrade to the newest compiler version. The device definitions and header files for new chips are quite often what I would consider to be "educated guesses" when they first appear, and the 12F1822 is quite new. I'm waiting for the 12F1840, but I know once it's finally out it will be a while before PICC supports it completely.

If upgrading is not an option for you (expired support, etc) you can at least try emailing CCS support to see if they can get you an updated device file.
mvanvliet



Joined: 02 Jun 2009
Posts: 123
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Apr 13, 2011 12:49 am     Reply with quote

ckielstra wrote:
Well, then why not do the upgrade?


Because it cost me $200, my maintainance has expired. (And I find it a bit disappointing that CCS adds the 12F1822 to their library, but it's functioning half)
mvanvliet



Joined: 02 Jun 2009
Posts: 123
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Apr 13, 2011 12:52 am     Reply with quote

dbotkin wrote:

If upgrading is not an option for you (expired support, etc) you can at least try emailing CCS support to see if they can get you an updated device file.


I mailed them last friday, but I still haven't got an response. When I mail the * in the subject I get: "status: reviewed" "priority: none".
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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