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

Blinking led on 18F4550

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



Joined: 12 Jul 2005
Posts: 49

View user's profile Send private message

Blinking led on 18F4550
PostPosted: Mon Oct 03, 2005 2:42 pm     Reply with quote

Hello all,

As I changing for 16F877 to the 18F4550, I wanted to test my new pic with the blinking led test.
I changed also from ICProg to WinPic800
Programming seems to go OK, verifieing and erasing is working.
But : I don't receive the expected blink rate. Changing to another pin ( another led with another color) works.
When I meassure the freq. (with a multimeter) it is about 40 khz.
So my led is constantly on.
Tryed to play already with other xtal without any result (changed from 20 mhz to 5.0688 mhz. with same 40 khz output on pin)

Anyone an idee ?

My code :
Code:
// VERSION : 0.1.0 : blinking blue led

#include <18F4550.h>
#fuses HS,NOWDT,NOPUT,NOLVP,BROWNOUT,NOCPD,NOWRT
#use delay(clock=20000000)

void main()
{
   while (TRUE)
   {
   output_HIGH(PIN_A0);
   delay_ms(10000);
   output_LOW(PIN_A0);
   delay_ms(10000);
   }
}

_________________
I like Skype (www.skype.com), my username is BplotM
VanHauser



Joined: 03 Oct 2005
Posts: 88
Location: Ploiesti, Romania

View user's profile Send private message

PostPosted: Mon Oct 03, 2005 3:52 pm     Reply with quote

Try changing the BROWNOUT fuse into NOBROWNOUT or add BORV20 fuse. Check your power supply voltage for a correct brown-out configuration.
Humberto



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

View user's profile Send private message

PostPosted: Mon Oct 03, 2005 5:09 pm     Reply with quote

Read the data sheet. The 18F family it is not a Plug&Play device.
Itīs a complex uC plenty of modules and functions that must be configured
properly before start running.

Code:

// VERSION : 0.1.0 : blinking blue led

#include <18F4550.h>

#FUSES NOWDT           //No Watch Dog Timer
#FUSES WDT128          //Watch Dog Timer uses 1:128 Postscale
#FUSES HS              //High speed Osc (> 4mhz)
#FUSES NOPROTECT       //Code not protected from reading
#FUSES BROWNOUT_NOSL   //Brownout enabled during operation,   
                         disabled during SLEEP
#FUSES BROWNOUT        //Reset when brownout detected
#FUSES BORV20          //Brownout reset at 2.0V
#FUSES PUT             //Power Up Timer
#FUSES NOCPD           //No EE protection
#FUSES STVREN          //Stack full/underflow will cause reset
#FUSES NODEBUG         //No Debug mode for ICD
#FUSES NOLVP           //No low voltage prgming, B3(PIC16) or B5(PIC18)
                         used for I/O
#FUSES NOWRT           //Program memory not write protected
#FUSES NOWRTD          //Data EEPROM not write protected
#FUSES IESO            //Internal External Switch Over mode enabled
#FUSES FCMEN           //Fail-safe clock monitor enabled
#FUSES PBADEN          //PORTB pins are configured as analog input channels on
                         RESET
#FUSES NOWRTC          //configuration not registers write protected
#FUSES NOWRTB          //Boot block not write protected
#FUSES NOEBTR          //Memory not protected from table reads
#FUSES NOEBTRB         //Boot block not protected from table reads
#FUSES NOCPB           //No Boot Block code protection
#FUSES MCLR            //Master Clear pin enabled
#FUSES LPT1OSC         //Timer1 configured for low-power operation
#FUSES NOXINST         //Extended set extension and Indexed Addressing
                         mode disabled (Legacy mode)
#FUSES PLL1            //No PLL PreScaler

#use delay(clock=20000000)

void main()
{
   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(FALSE);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(VREF_LOW|-2);
   setup_low_volt_detect(FALSE);
   setup_oscillator(False);

   while (TRUE)
     {
      output_toggle(PIN_A0);
      delay_ms(1000);
     }
}




Humberto
Bart



Joined: 12 Jul 2005
Posts: 49

View user's profile Send private message

Thanks for the reply's
PostPosted: Wed Oct 05, 2005 2:49 pm     Reply with quote

Thanks for the reply's.

Problem is found : it was due to my MAX232 ic.

I think it generated to much noise on the power line.
Adding a cap between pin 15 and 16 on the MAX232 of 10uF solved the problem.
_________________
I like Skype (www.skype.com), my username is BplotM
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