Adc Gpio
Adc Gpio
Adc Gpio
;=====================================================================
; M A I N C O D E - starts here
;=====================================================================
.text
_c_int0
NOP
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;Configure the System Control and Status Registers
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LDP #DP_PF1 ;set data page
;-----------------------------------------------------------------------
; RESET SECTION - BEGINS
;-----------------------------------------------------------------------
LDP #DP_EVA ;set data
page
SPLK #0000000001000101b, GPTCONA
SPLK #0, T1CNT
SPLK #40000,T1PR
SPLK #1042h,T1CON ;Continuous up-counting
;Disable
timer compare operation
SPLK #0100000000000000b,ADCTRL2
;----------------------------------------------------------------------
;Enable Global Interupts
;----------------------------------------------------------------------
CLRC INTM ;Enable interrupts
CLRC SXM
CLRC XF
;----------------------------------------------------------------------
LDP #DP_PF2
SPLK #0000h,MCRA
CHK_EOS1:
SUB #0FFh
BCND LOOP1,LT
LDP #RESULT
LACC RESULT
SUB #200h
BCND LOOP2,LT
LDP #RESULT
LACC RESULT
SUB #0400h
BCND LOOP3,LT
LDP #DP_PF2
SPLK #1111111111110000b,PBDATDIR
BANZ DELAY2
MAR *,AR1
BANZ LOOP1
B out1
BANZ DELAY4
MAR *,AR1
BANZ LOOP2
B out1
MAR *,AR1
BANZ LOOP3
out1: