\ SFR310.fs  03Feb08 rjn
\ Special function registers for the C8051F310
\
\ ---------- 310 SFRs
\ 
\ -----[ Port 0 ]-----
$80 constant P0      \ port0
$f1 constant P0MDIN  \ port0 input mode
$a4 constant P0MDOUT \ port0 output mode
$d4 constant P0SKIP  \ port0 Xbar skip enable bits
\
\ -----[ Port 1 ]-----
$90 constant P1      \ port1
$f2 constant P1MDIN  \ port1 input mode
$a5 constant P1MDOUT \ port1 output mode
$d5 constant P1SKIP  \ port1 Xbar skip enable bits
\
\ -----[ Port 2 ]-----
$a0 constant P2      \ port2
$f3 constant P2MDIN  \ port2 input mode
$a6 constant P2MDOUT \ port2 output mode
$d6 constant P2SKIP  \ port2 Xbar skip enable bits
\
\ -----[ Port 3 ]-----
$b0 constant P3      \ port3
$f4 constant P3MDIN  \ port3 input mode
$a7 constant P3MDOUT \ port3 output mode
\
\ -----[ Serial Port 0 ]-----
$98 constant SCON0    \ UART0 control
$99 constant SBUF0    \ UART0 data buffer 
\
\ -----[ SPI ]-----
$a1 constant SPI0CFG  \ SPI0 configuration
$f8 constant SPI0CN   \ SPIO control
$a2 constant SPI0CKR  \ SPI0 clock rate
$a3 constant SPI0DAT  \ SPI0 data
\
\ -----[ Timer ]-----
$88 constant TCON     \ timer control
$89 constant TMOD     \ timer mode
$8a constant TL0      \ timer0 low byte
$8B constant TL1      \ timer1 low byte
$8c constant TH0      \ timer0 high byte
$8d constant TH1      \ timer1 high byte
$c8 constant TMR2CN   \ timer2 control
$91 constant TMR3CN   \ timer3 control\
\
\ -----[ PCA ]-----
$d8 constant PCA0CN   \ PCA control
$d9 constant PCA0MD   \ PCA mode
$da constant PCA0CPM0 \ capture/compare mode register0
$db constant PCA0CPM1 \ capture/compare mode register1
$dc constant PCA0CPM2 \ capture/compare mode register2
$dd constant PCA0CPM3 \ capture/compare mode register3
$de constant PCA0CPM4 \ capture/compare mode register4
$f9 constant PCA0L    \ PCA counter/timer low byte
$fa constant PCA0H    \ PCA counter/timer low byte
$fb constant PCA0CPL0  \ PCA capture module0 low byte
$e9 constant PCA0CPL1  \ PCA capture module1 low byte
$eb constant PCA0CPL2  \ PCA capture module0 low byte
$ed constant PCA0CPL3  \ PCA capture module1 low byte
$fd constant PCA0CPL4  \ PCA capture module1 low byte
$fc constant PCA0CPH0  \ PCA capture module0 high byte
$ea constant PCAC0PH1  \ PCA capture module1 high byte
$ec constant PCA0CPH2  \ PCA capture module2 high byte
$ee constant PCA0CPH3  \ PCA capture module3 high byte
$fe constant PCA0CPH4  \ PCA capture module3 high byte
\
\ -----[ Clock ]-----
$8E constant CKCON    \ clock control
\
\ -----[ Oscillator ]-----
$b3 constant OSCICL   \ internal oscillator calibration
$b2 constant OSCICN   \ internal oscillator control
$a9 constant CLKSEL   \ clock select
$b1 constant OSCXCN   \ external oscillator control
\
\ -----[ Flash ]-----
$8f constant PSCTL    \ program store R/W control
$b7 constant FLKEY    \ flash lock and key
$b6 constant FLSCL    \ flash scale
\
\ -----[ Memory (XRAM) ]-----
$aa constant EMI0CN   \ external memory interface control
\
\ -----[ Crossbar ]-----
$e1 constant XBR0    \ port I/O crossbar Rigister 0
$e2 constant XBR1    \ port I/O croosbar Register 1
\
\ -----[ VDD Monitor ]-----
$ff constant VDM0CN    \ port I/O crossbar Rigister 0
\
\ -----[ Reset Source ]-----
$ef constant RSTSRC    \ port I/O crossbar Rigister 0
\
\ -----[ ADC ]-----
$d1 constant REF0CN    \ reference control
$bc constant ADC0CF    \ ADC0 configuration
$bb constant AMX0P     \ AMUX0 positive channel select
$ba constant AMX0N     \ AMUX0 negative channel select
$bd constant ADC0L     \ ADC0 data word LSB
$be constant ADC0H     \ ADC0 data word MSB
$e8 constant ADC0CN    \ ADC0 control (bit addressable)
[ : .ADC0CN ADC0CN + ; ]
:m ad0int  5 .ADC0CN m;  \ conversion complete interrupt flag
:m ad0bsy  4 .ADC0CN m;  \ conversion start flag
