gnupic: Here's a simple working GPAL example
Subject:
Re: Here's a simple working GPAL example
From:
Craig Franklin ####@####.####
Date:
24 Oct 2004 17:51:36 +0100
Message-Id: <417B9793.2010403@users.sourceforge.net>
David McNab wrote:
> David McNab wrote:
> > Hi,
> >
> > How do I import another module into a GPAL module?
> <snip>
>
> After a bit more playing around, I realised that:
> 1) the .pub files for whatever modules are being imported have to be
> listed on the gpal command line
> 2) the 'with "modulename" has to appear in the importing module.
>
> So my first successful 'hello, world' GPAL prog (for the benefit of
> others):
>
> 1. The code - helloleds.pal
>
> module helloleds is
>
> with p16f873a;
>
> pragma processor = "16f873a";
> pragma udata_section = "BANK0";
>
> procedure main is
>
> begin
> p16f873a.TRISB = 0x00;
> p16f873a.PORTB = 0xa5;
> asm
> sleep
> end asm;
> end procedure;
>
> end module;
>
> 2. Compiling the module:
>
> $ gpal -c helloleds.pal p16f873a.pub
>
> 3. Linking the module:
>
> $ gplink -s default.lkr -a inhx8m -c -o helloleds.hex helloleds.o
>
> (For the 'default.lkr' link script, I'm using the standard 16f873a.lkr
> gputils link script, with the extra line:
>
> SECTION NAME=BANK0 RAM=gpr0
>
> 4. Download the program, and it works
>
I am glad you figured it out.
Sorry I didn't respond to your last message sooner.
> (phew!)
>