This should work on an 18F2320. I have tons of code working on this chip but I don't have a way to program or test it here at work.

I did have a copy of an old file I was playing with and I edited it and posted it here.

Also, you need to use MPASM to compile your code with this chip. I am not sure about the 18F4523 but I would think it would too. You can select that option in MicroCode studio under options.

As you figured out before the datasheet is the best way to understand how to setup a chip. Setting or configuring the chip you are using can be difficult when you first start but after you get the hang of it and use the data sheet it gets easier.

'************************************************* ***************
'* Name : 18f2320 *
'* Author : [set under view...options] *
'* Notice : Copyright (c) 2005 [set under view...options] *
'* : All Rights Reserved *
'* Date : 2/14/2005 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************

DEFINE OSC 4

OSCTUNE = 0 ' at calibrated frequency so not offset
OSCCON = %01100000 'OSC at 4Mhz

@ __CONFIG _CONFIG1H, _INTIO2_OSC_1H & _IESO_OFF_1H ' use internal osc
@ __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L
@ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
@ __CONFIG _CONFIG3H, _MCLRE_OFF_3H & _PBAD_DIG_3H & _CCP2MX_OFF_3H
@ __CONFIG _CONFIG4L, _LVP_OFF_4L


ADCON0.0 = 0
ADCON1 = %11001111

CMCON = 7 'comparators off
CVRCON = 0
LVDCON = 0

'set pins for output
trisb = 0
trisc = 0
trisa = 0

LED var portb.7 ' could be any pin you want here all configured for outputs

'varible declarations

'constants



'set variable and misc.



goto endsub


endsub:


main:

high led
pause 200
low led
pause 200

end