# PIC10F222
# DOS: DOS-00655
# PS:  
# DS:  DS-41270

#device=PIC10F222

vpp (range=10.000-12.000  dflt=11.000)
vdd (range=2.000-5.500 dfltrange=3.000-5.500 nominal=5.000)

pgming (memtech=ee tries=1 lvpthresh=0)
    wait (pgm=2000 lvpgm=2000 eedata=2000 cfg=2000 userid=2000 erase=10000)
    latches(pgm=1 eedata=1 userid=1 cfg=1)

pgmmem (region=0x00-0x1FF)
cfgmem (region=0xFFF-0xFFF)
testmem (region=0x200-0x23F)
calmem (region=0x1FF-0x1FF)
userid (region=0x200-0x203)


NumBanks=1

sfr (key=INDF addr=0x0 size=1 flags=i access='u u u u u u u u')
    reset (por='--------' mclr='--------')
    bit (names='INDF' width='8')
sfr (key=TMR0 addr=0x1 size=1 access='rw rw rw rw rw rw rw rw')
    reset (por='xxxxxxxx' mclr='uuuuuuuu')
    bit (names='TMR0' width='8')
    stimulus (scl=rwb type=int regfiles=w pcfiles=w)
sfr (key=PCL addr=0x2 size=1 access='rw rw rw rw rw rw rw rw')
    reset (por='11111111' mclr='11111111')
    bit (names='PCL' width='8')
    stimulus (scl=rwb regfiles=w pcfiles=rw)
sfr (key=STATUS addr=0x3 size=1 access='rw rw u r r rw rw rw')
    reset (por='0--11xxx' mclr='q--qquuu')
    bit (names='GPWUF - - nTO nPD Z DC C')
sfr (key=FSR addr=0x4 size=1 access='r r r rw rw rw rw rw')
    reset (por='111xxxxx' mclr='111uuuuu')
    bit (names='FSR' width='8')
    stimulus (scl=rwb regfiles=w pcfiles=rw)
sfr (key=OSCCAL addr=0x5 size=1 access='rw rw rw rw rw rw rw rw')
    reset (por='11111110' mclr='11111110')
    bit (names='CAL FOSC4' width='7 1')
sfr (key=GPIO addr=0x6 size=1 access='u u u u r rw rw rw')
    reset (por='----xxxx' mclr='----uuuu')
    bit (names='- - - - GPIO3 GPIO2 GPIO1 GPIO0')
    bit (tag=scl names='GP' width='8')
    stimulus (scl=rwb regfiles=rw pcfiles=rw)
sfr (key=ADCON0 addr=0x7 size=1 access='rw rw u u rw rw rw rw')
    reset (por='11--1100' mclr='11--1100')
    bit (names='ANS - - CHS GO/nDONE ADON' width='2 1 1 2 1 1')
sfr (key=ADRES addr=0x8 size=1 access='rw rw rw rw rw rw rw rw')
    reset (por='xxxxxxxx' mclr='uuuuuuuu')
    bit (names='ADRES' width='8')
    stimulus (scl=rwb type=int regfiles=r)

                               # -------------------#
#------------------------------# Configuration Bits #------------------------------------#
                               # -------------------#

cfgbits (key=CONFIG addr=0xFFF unused=0xFE3)
    field (key=WDT mask=0x4 desc="Watchdog Timer")
        setting (req=0x4 value=0x4 desc="On")
        setting (req=0x4 value=0x0 desc="Off")
    field (key=CP mask=0x8 desc="Code Protect")
        setting (req=0x8 value=0x8 desc="Off")
            checksum (type=0x0 protregion=0x00-0x00)
        setting (req=0x8 value=0x0 desc="On")
            checksum (type=0x20 protregion=0x40-0x1FE)
    field (key=MCLRE mask=0x10 desc="Master Clear Enable")
        setting (req=0x10 value=0x10 desc="Functions as Master Clear")
        setting (req=0x10 value=0x0 desc="Functions as GP3")
    field (key=MCPU mask=0x2 desc="Master Clear Pull-up Resistor Enable")
        setting (req=0x2 value=0x2 desc="Disabled")
        setting (req=0x2 value=0x0 desc="Enabled")
    field (key=IOFSCS mask=0x1 desc="Internal Oscillator Speed Select")
        setting (req=0x1 value=0x1 desc="8 MHz")
        setting (req=0x1 value=0x0 desc="4 MHz")

                               # ---------------------------#
#------------------------------# Nonmemory-Mapped Registers #------------------------------------#
                               # ---------------------------#

nmmr (key=WREG addr=0x0 size=1 access='rw rw rw rw rw rw rw rw')
    reset (por='qqqqqqqq' mclr='qqqqqqqq')
    bit (names='WREG' width='8')
nmmr (key=STKPTR addr=0x1 size=1 flags=h access='rw rw rw rw rw rw rw rw')
    reset (por='00000000' mclr='00000000')
    bit (names='STKPTR' width='8')
nmmr (key=TRISIO addr=0x3 size=1 access='u u u u rw rw rw rw')
    reset (por='-----111' mclr='-----111')
    bit (names='- - - - - TRISIO2 TRISIO1 TRISIO0')
nmmr (key=OPTION_REG addr=0x5 size=1 access='rw rw rw rw rw rw rw rw')
    reset (por='11111111' mclr='11111111')
    bit (names='nGPWU nGPPU T0CS T0SE PSA PS' width='1 1 1 1 1 3')

                               # ------------#
#------------------------------# Peripherals #------------------------------------#
                               # ------------#

peripheral (key=GPIO sfrs='GPIO TRISIO' type=port)
    iopin (key=GPIO0 dir=inout)
        cnpin (key=GPIO0CN notify=CORE)
    iopin (key=GPIO1 dir=inout)
        cnpin (key=GPIO1CN notify=CORE)
    iopin (key=GPIO2 dir=inout)
    iopin (key=GPIO3 dir=in)
        cnpin (key=GPIO3CN notify=CORE)

#--------------------------------------------------------------------------------
# 				TIMERs
#--------------------------------------------------------------------------------
peripheral (key=TMR0 sfrs='TMR0')
    pinfunc (key=T0CKI port=GPIO2 dir=in)

#--------------------------------------------------------------------------------
# 				ADC
#--------------------------------------------------------------------------------
peripheral (key=ADC8 sfrs='ADCON0 ADRES')
    pinfunc (key=AN0 port=GPIO0 dir=in)
    pinfunc (key=AN1 port=GPIO1 dir=in)
    adgodone (key=ADCON0 mask=0x02)
#    interrupt (name=ADC enreg=PIE1 enmask=0x40 flgreg=PIR1 flgmask=0x40 prireg=NONE primask=0x00)

#--------------------------------------------------------------------------------
# 				MCLR
#--------------------------------------------------------------------------------
peripheral (key=MCLR)
    pinfunc (key=MCLR port=GPIO3 dir=in)
