Stanley Lee wrote:
> Hi,
> 
> Sorry for another email. I have received modified version of Jan's
> makefile. The compilation and build process is solved. However, I am
> encountering the same problem as I have experienced before, and that is
> the PIC18F2620 doesn't execute the operation of blinking the LEDs
> automatically right after external power is applied. I'm thinking of
> trying the same code (except for some fusebits/hardware tweaks on a
> PIC16F877A, PIC16F688, PIC16F690, or PIC16F628. Any suggestions if this
> thought is a feasible alternative to sideline the development?
>

Checked your code on a testboard with a pic18f2220 (sorry, no
oscilloscope here to test the blinking frequency) but they do blink here
with a few changes/advises to your code:

1. Use unsigned int not int for your delay function.
2. i would add _PWRT_ON_2L when using the internal oscillator to give
the  osc a few steps to stabilize before executing first code.
3. You *need* to tell sdcc (someone correct me here if its wrong) where
you want the stack to be. I usually put it onto gpr2 (or gpr1 for
smaller devices, see lkr file for the address of the gpr(s)). For the
pic18f2620 this would be

#pragma stack 0x200 0xff /* (<- always first line in main.c) */

somewhere at the start of the program. You will encounter non
predictable errors/misbehavior if your forgot this and sdcc sadly
doesn't warn you about it.

4. also the dly = dly; is not needed just add a ; after the while like
void delay(unsigned int dly)
{
   while(--dly > 0) ;
}

Now your programm runs fine.

jan


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to