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

Strange behavior of the CCS USB bootloader

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



Joined: 07 May 2011
Posts: 40
Location: Bulgaria

View user's profile Send private message

Strange behavior of the CCS USB bootloader
PostPosted: Sat Apr 19, 2014 5:11 am     Reply with quote

I am using the ccs usb bootloader (without changes) to upload my application but here is what happens when i do it:
I have a led connected to pin C7 which never lights when uploading the program through the bootloader. If i upload it by using a programmer (PICkit 3 in my case) everything is ok and the led lights up.

The only thing i changed i the ccs usb bootloader is the fuses. Here are my defines and fuses:
Code:
#include <18F4550.h>
   #device HIGH_INTS=TRUE
   #device adc=10
   #fuses HSPLL, PLL5, CPUDIV1, NOWDT, MCLR, PUT, NOLVP, USBDIV, VREGEN, BORV43, BROWNOUT, PROTECT, CPB, CPD
   #use delay(clock=48000000)

In my application i added absolutely the same fuses.

There is another problem too. I am generating a software PWM with 16.6Hz frequency and 800uS pulse width. When uploading the program with the programmer everything is ok but if i upload it through the bootloader pulse width is not 800uS - it is around 850uS. Here is the program:

My compiler version is 4.120.

Code:
#include <18F4550.h>
#device HIGH_INTS=TRUE
#device adc=10
#fuses HSPLL,PLL5,CPUDIV1,NOWDT,MCLR,PUT,NOLVP,USBDIV,VREGEN,BORV43,BROWNOUT,PROTECT,CPB,CPD
#use delay(clock=48000000)
#include <usb_bootloader.h>

#define PWM_OUT PIN_E2

#define TIMER0_PRELOAD 149
#define LOOPCNT 4925 //f=16.6Hz and T=60mS

int8 width=55;

#INT_RTCC HIGH //high priority interrupt
void tick_interrupt(void)
{
static int16 loop = LOOPCNT;
static int16 pulse;
 
set_timer0(get_timer0() + TIMER0_PRELOAD);
 
 if(--loop==0)
 {
  loop=LOOPCNT;
  pulse=width;
 }

  if(pulse)
  {   
   output_high(PWM_OUT);
   pulse--;
  }
  else output_low(PWM_OUT);
}


void main()
{
 setup_psp(PSP_DISABLED);
 setup_spi(FALSE);
 setup_wdt(WDT_OFF);
 setup_timer_0(RTCC_INTERNAL | RTCC_DIV_1 | RTCC_8_BIT);
 set_timer0(TIMER0_PRELOAD);
 enable_interrupts(INT_RTCC);
}
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