you can added this mcu ??
it´s very good,
USB + 12Bit´s A/D !!!
18F2553
Come on ....
Enjoy !
Code: Select all
program ADC_PIC18F2553
dim CurrentValue as word
sub function AdcRead_12bit(dim ch_ as byte) as word
ADCON2 = $87 'Right justified, FRC clock
ADCON0 = 0
ch_ = ch_ and $0F
ch_ = ch_ << 2
ADCON0 = ADCON0 or ch_ ' Set channel
ADCON0.0 = 1 ' A/D converter module is powered up
delay_us(2) ' Wait for TACQ time
ADCON0.1 = 1 ' Start conversion
while ADCON0.1 = 1 wend ' Wait for conversion complete
FSR2Ptr = @result ' Put conversion data in result
POSTINC2 = ADRESL
INDF2 = ADRESH
ADCON0.0 = 0 ' A/D converter module is powered down
end sub
main:
ADCON1 = $0E ' AN0
CurrentValue = AdcRead_12bit(0)
end.
Best regards, Florin Andrei Medrea.
http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/
mail : florin@microelemente.ro
http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/
mail : florin@microelemente.ro