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

simple code works for the 16f877 but doesnt for the 18f4455

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







simple code works for the 16f877 but doesnt for the 18f4455
PostPosted: Sun Nov 13, 2005 1:41 pm     Reply with quote

For some reason I cant get my 18F4455 to respond to code I'm putting on them.

To test if the code is good I use the same code recompiled on a 16f877 and it worked. I'm using the same test board also. Maybe I'm missing a connection required for the 4455?

Board connections

1 - +5v
11- +5v
12 - grd
13 - 20mhz cr
14 - 20mhz cr
31 - +5v
32 - grd
39 - LED

Again, when I place the 877 chip there it works great, but with I place the 4455, nothing works. When I recompile from chip to chip and I switch the drop down box to the proper chip and in MPlab I set the proper chip also. This is my firs time working with the 16bit chips, but I have done many projects with the 14 bit chips.

Thanks for the help

Nick

Here is the code.

Code:

#if defined(__PCM__)
#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)


#elif defined(__PCH__)
#include <18F4550.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)  // Jumpers: 8 to 11, 7 to 12
#endif



void main() {


output_high(pin_b7);
output_high(pin_b5);

while(1){

output_low(pin_b6);
delay_ms(1000);
output_high(pin_b6);
delay_ms(1000);
}

}
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

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

PostPosted: Sun Nov 13, 2005 3:47 pm     Reply with quote

Look at the LST file generated for each different compile. Make sure your fuse statements are correct for the two different chips.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Nov 13, 2005 4:46 pm     Reply with quote

Quote:
Maybe I'm missing a connection required for the 4455?

Board connections

1 - +5v
11- +5v
12 - grd
13 - 20mhz cr
14 - 20mhz cr
31 - +5v
32 - grd
39 - LED

Have you looked at the pin diagram for the 18F4455 ?
I assume you're using the 40-pin DIP package.

You have pin 1 connected directly to +5v, and normally it's connected
to +5v through a 10K resistor if you're using the Microchip ICD2, or
a 47K resistor for the CCS ICDU-40.

You have pins 31 and 32 reversed. Pin 31 should go to GND, and
pin 32 should go to +5v . You may have damaged the chip.

Also, you're using pins B6 and B7. Normally, if you're using a debugger
such as ICD2 or ICDU-40, you should avoid using those pins. Or at
least when you initially start working with a chip and you just want to
test it with a LED, etc., then pick some other pins for that test.
Guest








PostPosted: Sun Nov 13, 2005 5:05 pm     Reply with quote

You have pins 31 and 32 reversed. Pin 31 should go to GND, and
"pin 32 should go to +5v . You may have damaged the chip. "

I said that backward, I have it the way you stated. This exact setup works fine with the 16f877, i'm not sure if I'm compiling it correctly or maybe i'm messing up on the fuses. I'm not using the icd2 as a debugger just a programmer.

I also swapped out the +5v on pin 1 for a resistor and switch to a new chip. Still not working. Anything I could post that would help find my problem?

Thanks for the help so far.

Nick
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Nov 13, 2005 5:19 pm     Reply with quote

Post your version of the compiler. This is a number such as 3.191,
3.235, or 3.239, etc. It is found near the top of the .LST file, which
is in your project folder.
Nick
Guest







PostPosted: Sun Nov 13, 2005 7:14 pm     Reply with quote

it was the MPlab fuses, I was able to get a c18 blinking code running, but not CCS. I think CCS fuses are off because I tell it to use a HS and when I import into mplab i get XT. I fix that but it still doesnt run CCS code.

Nick
Nick
Guest







PostPosted: Sun Nov 13, 2005 7:27 pm     Reply with quote

It works, the error was I added an extra '0' in the first delay and I never wait 10 seconds for a blinking led program to start.

Still there is a problem with the fuse being imported improperly into mplab v7.00

Atleast I'm well ahead of were i was at 10 minutes ago!

Thanks everyone

Nick
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