18F2553

Post your requests and ideas on the future development of mikroBasic.
Post Reply
Author
Message
fzanoto
Posts: 225
Joined: 25 Jul 2006 13:53

18F2553

#1 Post by fzanoto » 15 May 2007 19:41

you can added this mcu ??
it´s very good,
USB + 12Bit´s A/D !!!

fzanoto
Posts: 225
Joined: 25 Jul 2006 13:53

#2 Post by fzanoto » 30 Sep 2008 17:42

Adc_Read(0) in 12 bit´s don´t work ???

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#3 Post by yo2lio » 30 Sep 2008 18:33

Come on .... 8)

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.
Enjoy !
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

Post Reply

Return to “mikroBasic Wish List”