Source Code File:"adcbaslib.bas"

'********************************************************
'*                                                      *
'*        ADC LIBRARY FOR USE WITH BOOST BASIC          *
'*                                                      *
'*      WRITTEN BY      :  PUNERJOT SINGH MANGAT        *
'*      COUNTRY         :  INDIA                        *
'*      CITY            :  PATIALA                      *
'*      WEB PAGE        :  www.rackeys.com/punerjot     *
'*      EMAIL           :  punerjot@rackeys.com         *
'*      SOURCEBOOST ID  :  c58_4311                     *
'*      RELEASE DATE    :  March 03, 2006               *
'*      REVISED DATE    :  May 24, 2006                 *
'*                                                      *
'********************************************************
'
'
' commandas are:
' adc_init()
' adc_read()
'
'



'***************************initiating ADC port starts ************************
sub adc_init()
trisa  = ( 00000001b )          'pin A0 is for analog input
adcon1 = ( 10001110b )          'setting for only AN0 and ref of vss and vdd, Fosc/8
adcon0 = ( 01000001b )          'setting for channel AN0 and Fosc/8 for 4Mhz, start AD
end sub
'***************************initiating ADC port ends **************************



'****************** getting the value from the ADC port starts ****************
function adc_read() as byte
adcon0.2 = 1
call delay_ms(1)
adcon0.2 = 0
call delay_ms(1)
adc_read = adresl
end function
'****************** getting the value from the ADC port ends ******************

http://www.sourceboost.com

Copyright © 2006 SourceBoost Technologies