Sorry for the additional spam, but I have a few more questions about the Makefile as I am on the way of switching away from using piklab ide and more towards using the Makefile. The questions are embedded in the Makefile:

PROG_NAME = LED_toggle.hex
OBJS = main.o


sdcc_PIC_TYPE = 18f2620
lkr_PIC_TYPE = 18f2620
TOOLSDIR = /usr/local/
CC = $(TOOLSDIR)/bin/sdcc
CFLAGS = -mpic16 -V -p$(sdcc_PIC_TYPE) $(DEBUG) --denable-peeps --opt-code-size --optimize-cmp --optimize-df --fstack
LNK = $(TOOLSDIR)/bin/sdcc
INC = -I.
LDFLAGS = -L/usr/local/share/sdcc/lib/pic16/
CRT = --use-crt=crt0.o -V
#DEBUG = --denable-peeps --obanksel=9 --opt-code-size --optimize-cmp --optimize-df --fstack

all: $(PROG_NAME)

#for the .c.o directive below, do I need to replace it with the <filename>.c <filename>.o instead of .c.o? i.e. how would I know which source code to compile and build?

       $(CC)  $(CFLAGS) $(INC) -c $<

#rule to link the final executable
       $(LNK) $(DEBUG) $(LDFLAGS) $(CRT) -Wl-s$(lkr_PIC_TYPE).lkr,-m -mpic16 -p$(sdcc_PIC_TYPE) $+ -o $(@) -llibio$(sdcc_PIC_TYPE).lib - llibc18f.lib
prog: $(PROG_NAME)
       piklab-prog --programmer=direct --port=/dev/parport0 --device=$(sdcc_PIC_TYPE) --command=program $(PROG_NAME)

#would the prog directive be telling the makefile to flash the hexfile to the microcontroller? if I am using PICKIT2 programmer, would I be commanding the programmer to look in /dev/usbxxx, x being number?

       rm -f *.o *.rel *.lst *.cod *.hex *.map *.asm# change this to your program name



On 9/29/07, Stanley Lee <> wrote:
Hi Olgierd,

I'm not connecting the usb port and the dc source at the same time. I tried each power source separately, and took note of that in the problem report.


On 9/29/07, Olgierd Eysymontt <> wrote:
May be you are connecting the usb port and the dc source at the same time, in that case yo can have big currents between the computer and board. I've had similar problems with a usb oscilloscope because it's very difficult to isolate the usb bus so it's ussually referenced to ground.

I hoe it helps,

Olgierd Eysymontt

2007/9/29, Stanley Lee <>:
Once again, thanks to Jan and Raphael for their help for getting me started with a template for the C codes on SDCC fusebit syntax. My newest version of the LED blinking code is posted on

However, I am having a problem of my PIC18F2620 not starting the control execution properly when I use my DC adapter as the power source. Eventually, I will be using the microcontroller on a portable battery, but for now, I'm using a DC adapter for development and testing purposes. I am suspecting that either I'm not setting the fusebits properly or I'm experiencing a problem with my power supply, which might require me to set up brown out reset and power up timer. How can I tell whether I have a fusebit configuration problem or whether I have a problem with my power supply?



This email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
Sdcc-user mailing list