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

16f877 to 18F452 error in the programing

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



Joined: 24 Mar 2004
Posts: 53
Location: Portugal

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

16f877 to 18F452 error in the programing
PostPosted: Wed Jun 01, 2005 5:13 am     Reply with quote

Hello
I do the migration of 16f877 to 18F452, because the 16F877 have no memory.
I use the PICSTART plus with the new upgrade KIT.
In the program I change the configurations bits like:
Code:

//16f877
#fuses HS,NOPROTECT,NOWDT,NOLVP,PUT,NOBROWNOUT

to

//18f452
#fuses HS,NOWDT,NOPROTECT,NOLVP,NOOSCSEN,NOBROWNOUT,NOSTVREN,NOPUT,NOEBTRB,NOEBTR,NOCPB,NOCPD,NOWRT,NOWRTD,NOWRTC,NOWRTB,NODEBUG

The compile is OK - BUILD SUCCEEDED.

When I do Program with picstart plus, have ERROR in the midle of programing.

I sse all topic with the migration of 16f877 to 18F452 but I can't program the processor.

Thanks

Carlos
JPA
Guest







PostPosted: Wed Jun 01, 2005 8:04 am     Reply with quote

I remember I have read some strange behaviour when programming some new PICs with PICSTART+. It seems to come from PICSTART hardware. See Microchip forum for more information.
carlosma



Joined: 24 Mar 2004
Posts: 53
Location: Portugal

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

PostPosted: Thu Jun 09, 2005 3:55 am     Reply with quote

Hello,
please now the programming is OK but with 18F452 the program dont work
I see all configuration bits possible.

Parts of my program:

Code:

#include <18F452.h>     
#include <math.h>
#include <stdlib.h>
#fuses HS,NOPROTECT,NOWDT,NOLVP,PUT,NOBROWNOUT       
#use delay(clock=4000000)
#include <pcf8570.c>
#include <LCD.C>                 
#include <kbd.C>
//...
//

#int_timer0
timer0_isr()
{
   clock-=256;
   if(clock<256)
      {
      clock+=CLOCK_VAL;
      tick=1;
      seconds++;
      }
}

#int_timer1
timer1_isr()
{
set_timer1(65200);
  // Decrement any timers that are running.
if(gc_buttons_timer)
   gc_buttons_timer--;
if(entradas_zona_timer)
   entradas_zona_timer--;
  }

void init_chip()
{
   lcd_init();   
   kbd_init();
    setup_adc_ports(NO_ANALOGS);
   setup_timer_0(RTCC_INTERNAL | RTCC_DIV_8); ///eu
     setup_timer_1 (T1_INTERNAL);
   set_timer1(65200);
   enable_interrupts(int_timer0); // Enable timer0 interrupt
    enable_interrupts(int_timer1);
    enable_interrupts(GLOBAL);     // Enable global interrupts
   calculo_angulo();
}

//...
//
main()
{
   gc_buttons_timer = BUTTONS_TIMER_TICKS;

   init_chip();
   while(1)
   {
      if (tick)
      {
         tick=0;
         update_clock();
         led2 = !led2;
   output_bit (pin_e1,led2);
      }

//...
//
       check_buttons();
      entradas_zona(); // check inputs
   math_calcul(); // math calculation use math complex- sin(), cos() and tang();
   motor_output();

//...
   }

helps me in the migration of 16F877 to 18F452
Ttelmah
Guest







PostPosted: Mon Jun 13, 2005 9:56 am     Reply with quote

You need to go through all your include files (your ones, not the 'system' ones), looking for any #byte, or #bit definitions. These will need to be changed to the required addresses for the latter chips (very different).
I'd suspect the routine you refer to as 'check inputs', as a possible starting place.

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jun 13, 2005 11:37 am     Reply with quote

When you move to a new PIC, don't start with a complicated program.
Start with a simple program that just blinks a LED, or displays "Hello
World". Get that program running OK. Then try your big program.
Example:
Code:
#include <18F452.h>
#fuses XT, NOWDT,NOPROTECT, PUT, BROWNOUT, NOLVP
#use delay(clock = 4000000)   
//========================================
void main()
{

while(1)
  {
   output_high(PIN_B0);   
   delay_ms(500);

   output_low(PIN_B0);
   delay_ms(500);
  }

}
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