gnupic: Re: [gnupic] How do I set configuration bits for 18f252 in gpasm?
Subject:
Re: [gnupic] How do I set configuration bits for 18f252 in gpasm?
From:
David Froseth ####@####.####
Date:
8 Jun 2006 21:49:07 +0100
Message-Id: <44888D35.1010202@umich.edu>
Thanks George for the reply. In the gputils documentation, I could not
find anything about how to do a settup like you have. Am I missing an
include file? Maybe this is common knowledge.
Here is what I did to get __config working. At least to me, it looks
like it is working. Here is some of the gpasm output:
00021 list p=18f252
00022
00300001 00023 _config1h equ 0x300001
00300002 00024 _config2l equ 0x300002
00300003 00025 _config2h equ 0x300003
00300005 00026 _config3h equ 0x300005
00300006 00027 _config4l equ 0x300006
00028
00029
300000 FAFF 00030 __config _config1h, b'11111010' ;HS
oscillator
00031 __config _config2l, b'11111110'
;enable power-up timer
300002 FEFE 00032 __config _config2h, b'11111110'
;watchdog timer disabled
300004 FFFF 00033 __config _config3h, b'11111111' ;
300006 FFFB 00034 __config _config4l, b'11111011'
;Disable LVP
00035
The program address and the program data is where it should be. Since I
did not define a config1l at 0x300000, the assembler automatically
writes all 1's with the lower byte of the 0x300000 address being 'FF'.
0x300001 is 'FA' as it should be. So, it also seems that my original
numbers were wrong - unused bits should be written as '1', correct?
I also fixed problems with the 'retfie FAST' instruction.
I was getting an error:
Error [113] : Symbol not previously defined (FAST).
001C 0010 00183 retfie FAST
In the PIC18FXX2 documentation (pg. 217) the retfie instruction word is
defined as - 0000 0000 0001 000s, where s=1, if you want certain
registers restored from shadow registers when returning from an
interrupt (pg. 214).
So I defined FAST as '1':
FAST equ 0x01
Now I get this output from gpasm:
001C 0011 00183 retfie FAST
00184
This seems right since the op-code word is now '0011'h, which equals
'0000 0000 0001 0001'. Do I have this right?
One last question - Does the '&' symbol in '_OSCS_OFF_1H & _HS_OSC_1H'
cause gpasm to do an AND logic function on the two bits represented by
the mnemonics?
Thanks.
George M. Gallant, Jr. wrote:
> gpasm does a fine job with the 18f252. Here is my current setup.
>
> George
>
> ; __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HS_OSC_1H
> __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HSPLL_OSC_1H
>
> __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L &
> _BORV_20_2L
> __CONFIG _CONFIG2H, _WDT_OFF_2H
>
> __CONFIG _CONFIG4L, _DEBUG_OFF_4L & _LVP_OFF_4L &
> _STVR_ON_4L
>
> __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L
> __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
>
> __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L
> __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H &
> _WRTD_OFF_6H
>
> __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L
> __CONFIG _CONFIG7H, _EBTRB_OFF_7H
>
>
>
>
> On Thu, 2006-06-08 at 14:24 -0400, David Froseth wrote:
>
>
>>I would like to use gpasm to make a hex file for a 18f252 pic. However,
>>I am unsure of how to write the code, which sets up the configuration
>>bits. The 18f parts have several config files located in 0x300001 -
>>0x30000d of the program memory. How do I write my assembly program so
>>that gpasm knows what to do?
>>
>>I would like to have these values in the various config files:
>>
>>config1h = b'00100010'
>>config2l = b'00001110'
>>config2h = b'00001110'
>>config3h = b'00000001'
>>config4l = b'10000001'
>>
>>Thanks for any advice.
>>
>>p.s. Does gpasm support all of the additional instructions of the
>>enhanced 18f parts - i.e. bra, movlb, movff, etc?
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: ####@####.####
>>For additional commands, e-mail: ####@####.####
>>
>
>