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

16f628 pic compiler giving errors

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







16f628 pic compiler giving errors
PostPosted: Sun Nov 28, 2004 3:47 pm     Reply with quote

hey guys i am trying to start using the 16f628 chip and am having difficulty getting the program below to compile. i get a red error along the bottom that says (too many nested #includes). why am i getting this error and how do i fix it??

thanks
matt

Code:
#include "C:\Program Files\PICC\Devices\16F628.h"
#include <LCD.C>
#include <stdio.h>



void main()
{

   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   lcd_init();
while(1){
   lcd_putc("hello world");
   lcd_putc("\n PIC 16f628");
}

}
buckeyes1997
Guest







nevermind
PostPosted: Sun Nov 28, 2004 4:34 pm     Reply with quote

okay i figured out why it was doing that however i managed to ruin 2 16f628's in the last 20 minutes. i dont even know how i ruined them but they are not recognized by the programmer any longer and do nothing in the circuit. i thought they were almost direct replacement for the 16f84's. i changed the header file and setup the fuses to use mclr, xp, nolvp, put, etc. as soon as i tried to run my existing lcd program the chips were ruined. is there something obvious that im doing to ruin this chip so fast??
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Sun Nov 28, 2004 5:53 pm     Reply with quote

Just a note:
Code:
while(1){
   lcd_putc("hello world");
   lcd_putc("\n PIC 16f628");
}


You probably want it to be
Code:

lcd_putc("hello world");
lcd_putc("\n PIC 16f628");
while(1){
}


or do you really want to keep writing over and over to the LCD forever.
buckeyes1997
Guest







thanks
PostPosted: Mon Nov 29, 2004 6:29 pm     Reply with quote

hey thanks mark
no i dont want that particular message printed over and over...i had a variable in the second line that i wanted updated and just changed it for debugging purposes.

my real problem is that somehow i went threw 2 628's in about an hour. i had it wired exactly like i did for the f84 and it blew them. what options should be turned on for the 628 to be pin for pin compatible?? i assumed that since the 84 has a mclr pin that i should enable the mclr on the 628 right? everything else is the same as far as i can tell fuse wise other than telling it to not use LVP.
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

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

PostPosted: Mon Nov 29, 2004 8:35 pm     Reply with quote

Quote:
my real problem is that somehow i went threw 2 628's in about an hour. i had it wired exactly like i did for the f84 and it blew them.


If you mean you destroyed them - how do you know this? Have you tried erasing and then reprogramming? Is there signs of physical damage? It may be that the configuration bits are set for code protection.

If the device is physically destroyed then it has nothing to do with 16F84 versus 16F628 - look for power supply wiring errors. Or, if you have your programmer powered independantly from the PIC - look for problems in this area - ground connections etc. You could be getting into a latchup scenario in this case a 16F84 can be destroyed as easily as a 16F628
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
buckeyes1997
Guest







PostPosted: Tue Nov 30, 2004 9:44 am     Reply with quote

basically i tried to program it and the first time it worked fine and programmed but then i put it in the exact same circuit that the f84 was in and it did nothing so then i went to reprogram it and the programmer doesnt recognize it and wont program/erase it at all. i think that something resulted from putting it in the circuit because they programmed fine the first time and after placing it in the circuit that the f84 was in it stopped working. i read that it is a pin out twin of the f84 but there are a few small software differences. i thought i programed the fuses right but maybe that is the problem. i told it to use MCLR, PUT, NOLVP, XT, and that was it i think. the code shouldnt be protected if i dont tell it to use it right?
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

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

PostPosted: Tue Nov 30, 2004 10:52 am     Reply with quote

What programmer are you using? My guess is a hardware fault such as wiring error, chip inserted the wrong way around, voltage supply problem as previously mentioned.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Tue Nov 30, 2004 11:39 am     Reply with quote

Hi buckeyes1997,

As asmallri told you
Quote:

What programmer are you using? My guess is a hardware fault such as wiring error, chip inserted the wrong way around, voltage supply problem as previously mentioned.


I guess the same. There is no way to destroy a chip unless a hardware fault.
If you apply voltage in reverse way, it doesn´t burn. Some programmers doesn´t
translate the configuration register settings according to the object file. Read the
config register and check if the CodeProtect bit is set.

Best wishes,

Humberto
buckeyes1997
Guest







hmmm
PostPosted: Tue Nov 30, 2004 8:30 pm     Reply with quote

well its not like i physically melted the chip or something. all i did was put it in a working 16f84 circuit and it didnt work as it was supposed to so i tried to reprogram it and the programmer didnt recognize the chip and therefore wouldnt program it at all. the circuit was wired correctly as it worked with the other pic and this one is supposed to be a drop in replacement. the programmer has programmed these chips before without any issues so its not the programmer as far as i can tell.

with the mclr pin on the 84 held high and doing the same thing with the 628 might be the problem as the pinout shows it as (notMCLR) instead of MCLR.
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

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

Re: hmmm
PostPosted: Tue Nov 30, 2004 8:40 pm     Reply with quote

Have I understood the following correctly.

1. You took an operational bit of hardware with a PIC16F84 in it.

2. You removed the PIC16F84 from the operational hardware.

3. You programed a PIC16F628 and inserted it into the operational hardware

4. When it did not work you removed the PIC16F628 from the hardware and installed the PIC16F84 back into the operational hardware

5. The hardware is now operating correctly with the PIC16F84

Is this 100% correct?

Quote:
... it didnt work as it was supposed to

it didn't work at all or it worked with bugs?

Quote:
with the mclr pin on the 84 held high and doing the same thing with the 628 might be the problem as the pinout shows it as (notMCLR) instead of MCLR.


The MCLR pin is active low for both devices.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Charlie U



Joined: 09 Sep 2003
Posts: 183
Location: Somewhere under water in the Great Lakes

View user's profile Send private message

PostPosted: Tue Nov 30, 2004 9:18 pm     Reply with quote

This may be way off target, but is there a chance that you some how managed to get the parts into low voltage programming mode. In that case, if your circuit holds the program pin (RB4) high, the part will be in LVP mode and not do anything. Also, there are known problems with programming these parts (16F627 and 628) in "high voltage" mode if RB4 is floating. Try pulling RB4 to ground with a resistor around 4.7k or so if you can while it is in the programmer and try reprogramming them and make certain that low voltage mode is off.
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