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

CCS C + Proteus + PIC18F problem

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



Joined: 14 Aug 2009
Posts: 7

View user's profile Send private message

CCS C + Proteus + PIC18F problem
PostPosted: Wed Sep 23, 2009 1:17 am     Reply with quote

Dear Sir,
I am working with CCS C Version 4.057. When I code using MPLAB and CCS C, I used Proteus 7.5 SP3 as a debugger. Whatever program I wrote, worked fine with Proteus. But when I write the hex data to Pic18f452 or PIC18f4553 (each chip is separately coded and programmed), nothing works on the chip. Even basic LED programs did not work.
Then I used MPLAB C18 Compiler and put a basic program of LED Blink using that on to Proteus and then burned the chip. This time led blink was working on the Microcontrollers put on my demo board.
Hence I suspected that some precautions to be taken while using CCS C 's hex data when put on to the Chip.

Can you please help me sir.

Thank You

Regards,
GLFU
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Wed Sep 23, 2009 1:54 am     Reply with quote

Quote:
I suspected that some precautions to be taken while using CCS C 's hex data when put on to the Chip.
Not particularly.
There are popular errors e.g. in fuse settings, that are possibly ignored in simulation. Just show a minimal (complete with all #fuses and include statements) CCS C program, that doesn't work as expected.
ckielstra



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

View user's profile Send private message

PostPosted: Wed Sep 23, 2009 5:47 pm     Reply with quote

Quote:
There are popular errors e.g. in fuse settings, that are possibly ignored in simulation.
True.
Proteus is not simulating all PIC hardware, especially the clock circuit is left out. In Proteus you say 'this processor is running at 10MHz' and it will simulate even when no clock or crystal is connected.

The code running with the C18 compiler suggests the hardware is setup correct. A difference between C18 and CCS is the configuration of the processor fuses. Like FvM said, post a small but complete test program.
greatluckforu



Joined: 14 Aug 2009
Posts: 7

View user's profile Send private message

thank you.Please see my sample code that did not work
PostPosted: Wed Sep 23, 2009 11:45 pm     Reply with quote

Dear Sir,
I am using a 16KDS(crystal) and PIC18F4553.
This is my sample code to toggle port.
Code:

#include <18F4553.h>
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,CPUDIV1
#use delay(clock=16000000)
#use rs232(baud=57600, xmit=PIN_E0, rcv=PIN_E1, FORCE_SW,ERRORS)

void main(void)
{
while(1){
output_d(0xff);
delay_ms(500);
output_d(0x00);
delay_ms(500);
}
}

This compiles and runs on proteus with perfect timings.

Please help me with information on how to set fuses using CCS C.

Regards,
GLFU
greatluckforu



Joined: 14 Aug 2009
Posts: 7

View user's profile Send private message

Thank You.
PostPosted: Wed Sep 23, 2009 11:56 pm     Reply with quote

Dear Sirs,
Thanks very much for the help.
I was using HSPLL and I had to use HS.
You are really kind people with great minds.
Thanks for the help.
But sir,
Please help me regarding the following program. I want to use software uart for sending and receiving rs232 data.
I am using the following sample code before testing any thing. But the problem is this is not sending any data at all to the port D pin.
Code:

#include <18F4553.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=16000000)
#use rs232(baud=57600, xmit=PIN_D0, rcv=PIN_D1, FORCE_SW,ERRORS)

//======================================
void main(void)
{
int8 c;

while(1)
  {
 
   //c = getc();
   putc(0xaa);
delay_ms(50);
  }
 
}

Please help me sir.

Regards,
GLFU
salgulsen



Joined: 16 Sep 2009
Posts: 21

View user's profile Send private message

PostPosted: Thu Sep 24, 2009 1:28 am     Reply with quote

Hmmm....

Shouldnt you disable the PSP function before using the Port D? With the code : setup_psp(PSP_DISABLED); ?

If you dont disable the portD parallel communication, that might cause you some problem.... just write it under main like :

Code:

void main()

{
   setup_psp(PSP_DISABLED);
   // code here
}


Hope it works

Salih
greatluckforu



Joined: 14 Aug 2009
Posts: 7

View user's profile Send private message

did not work..please help
PostPosted: Thu Sep 24, 2009 6:14 am     Reply with quote

Dear Sir,
the uart program did not work with setup_psp(PSP_DISABLED).
THe Hardware uart also did not work with the program mentioned above.
Can anyone help me with a working UART program for PIC18F4553 or PIC18F4550 or PIC18LF452?

Regards,
GLFU.
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