SetAllDigital
Feel free to edit the code - make sure you test it first! Please add useful comments, for example, why a change was made...
public sub SetAllDigital() // 4 channels #if _device in (18F1230, 18F1330) ADCON1 = $00 CMCON = $07 // 5 channels, ANSEL... #elseif _device in (18F2331, 18F2431) ANSEL0 = $00 // 9 channels, ANSEL... #elseif _device in (18F4331, 18F4431) ANSEL0 = $00 ANSEL1.0 = 0 // 7 channels, bit field... #elseif _device in (18F1220, 18F1320) ADCON1 = $7F // 8 - 13 channels - 0 comp #elseif _comparator = 0 ADCON1 = $0F // J11 and J16 family... #elseif _device in (18F66J11, 18F66J16, 18F67J11, 18F86J11, 18F86J16, 18F87J11) ANCON0 = $FF ANCON1 = $FF // J50 and J55 family... #elseif _device in (18F65J50, 18F66J50, 18F66J55, 18F67J50, 18F85J50, 18F86J50, 18F86J55, 18F87J50) ANCON0 = $FF ANCON1 = $FF #else ADCON1 = $0F CMCON = $07 #endif end sub
Additional Notes
Originally posted 20th April 2007 - David Barker