 |
www.elektronik.si Forum o elektrotehniki in računalništvu
|
| Poglej prejšnjo temo :: Poglej naslednjo temo |
| Avtor |
Sporočilo |
SIMON ZORKO Član

Pridružen-a: Pet 19 Sep 2008 11:20 Prispevkov: 14 Aktiv.: 0.07 Kraj: zg.Volicina
|
Objavljeno: Pon Jun 27, 2011 2:16 pm Naslov sporočila: Programiranje mikrobasic začetne težave |
|
|
Lepo pozdravljeni
Lotil sem se učenja programiranja PICov. Uporabil sem prevajalnik Mikrobasic od mikroelektronike. V knjižnici sem našel rutino za meritev temperature z senzorjem ds1820. Program je napisan za PIC 16F887. Spremenil sem vrata na katera pride priključen DS1820- namesto PORTE, 2 sem spremenil v PORTA, 2 saj bom uporabil PIC 16F876A. Zataknilo se mi je pri izklopitvi analognih vhodov na portu A. Ukaza ANSEL=0 in ANSELH=0 prevajalnik ne sprejme in javi napako. Prosil bi za pomoč, nekoga ki stvar pozna. Uporabil bom 4Mhz kristal in 16*2 LCD zaslon ter PIC 16F876A. Hvala.
program OneWire
' Lcd module connections
dim LCD_RS as sbit at RB4_bit
LCD_EN as sbit at RB5_bit
LCD_D4 as sbit at RB0_bit
LCD_D5 as sbit at RB1_bit
LCD_D6 as sbit at RB2_bit
LCD_D7 as sbit at RB3_bit
LCD_RS_Direction as sbit at TRISB4_bit
LCD_EN_Direction as sbit at TRISB5_bit
LCD_D4_Direction as sbit at TRISB0_bit
LCD_D5_Direction as sbit at TRISB1_bit
LCD_D6_Direction as sbit at TRISB2_bit
LCD_D7_Direction as sbit at TRISB3_bit
' End Lcd module connections
' Set TEMP_RESOLUTION to the corresponding resolution of used DS18x20 sensor:
' 18S20: 9 (default setting can be 9,10,11,or 12)
' 18B20: 12
const TEMP_RESOLUTION as byte = 9
dim text as byte[9]
temp as word
sub procedure Display_Temperature( dim temp2write as word )
const RES_SHIFT = TEMP_RESOLUTION - 8
dim temp_whole as byte
temp_fraction as word
text = "000.0000"
' check if temperature is negative
if (temp2write and 0x8000) then
text[0] = "-"
temp2write = not temp2write + 1
end if
' extract temp_whole
temp_whole = word(temp2write >> RES_SHIFT)
' convert temp_whole to characters
if ( temp_whole div 100 ) then
text[0] = temp_whole div 100 + 48
else
text[0] = "0"
end if
text[1] = (temp_whole div 10)mod 10 + 48 ' Extract tens digit
text[2] = temp_whole mod 10 + 48 ' Extract ones digit
' extract temp_fraction and convert it to unsigned int
temp_fraction = word(temp2write << (4-RES_SHIFT))
temp_fraction = temp_fraction and 0x000F
temp_fraction = temp_fraction * 625
' convert temp_fraction to characters
text[4] = word(temp_fraction div 1000) + 48 ' Extract thousands digit
text[5] = word((temp_fraction div 100)mod 10 + 48) ' Extract hundreds digit
text[6] = word((temp_fraction div 10)mod 10 + 48) ' Extract tens digit
text[7] = word(temp_fraction mod 10) + 48 ' Extract ones digit
' print temperature on Lcd
Lcd_Out(2, 5, text)
end sub
main:
ANSEL = 0 ' Configure AN pins as digital I/O
ANSELH = 0
text = "000.0000"
Lcd_Init() ' Initialize Lcd
Lcd_Cmd(_LCD_CLEAR) ' Clear Lcd
Lcd_Cmd(_LCD_CURSOR_OFF) ' Turn cursor off
Lcd_Out(1, 1, " Temperature: ")
Lcd_Chr(2,13,178) ' Print degree character, "C" for Centigrades
' different Lcd displays have different char code for degree
Lcd_Chr(2,14,"C") ' if you see greek alpha letter try typing 178 instead of 223
'--- main loop
while (TRUE)
'--- perform temperature reading
Ow_Reset(PORTA, 2) ' Onewire reset signal
Ow_Write(PORTA, 2, 0xCC) ' Issue command SKIP_ROM
Ow_Write(PORTA, 2, 0x44) ' Issue command CONVERT_T
Delay_us(120)
Ow_Reset(PORTA, 2)
Ow_Write(PORTA, 2, 0xCC) ' Issue command SKIP_ROM
Ow_Write(PORTA, 2, 0xBE) ' Issue command READ_SCRATCHPAD
temp = Ow_Read(PORTA, 2)
temp = (Ow_Read(PORTA, 2) << 8) + temp
'--- Format and display result on Lcd
Display_Temperature(temp)
Delay_ms(520)
wend
end. |
|
| Nazaj na vrh |
|
 |
Krampus Član



Pridružen-a: Pon 08 Sep 2008 13:07 Prispevkov: 1870 Aktiv.: 8.72
|
Objavljeno: Pon Jun 27, 2011 7:42 pm Naslov sporočila: |
|
|
MikroBasic ali MikroBasic Pro?
Katera verzija?
PIC 16F876A ima druge registre za analogni del, preberi datasheet
ADCON0 in ADCON1 _________________ Nisem ravno najbolj pameten na svetu, tu in tam pa imam kakšno idejo. |
|
| Nazaj na vrh |
|
 |
SIMON ZORKO Član

Pridružen-a: Pet 19 Sep 2008 11:20 Prispevkov: 14 Aktiv.: 0.07 Kraj: zg.Volicina
|
Objavljeno: Pon Jun 27, 2011 11:09 pm Naslov sporočila: |
|
|
| Uporabljam mikroBasic PRO for PIC od Mikroelektronike, verzijo ki je trenutno dostopna na njihovi strani. Bom pogledal Datasheet od PIC 16F876A za analogne vhode. |
|
| Nazaj na vrh |
|
 |
Highlag Član


Pridružen-a: Pet 23 Jan 2004 20:42 Prispevkov: 4034 Aktiv.: 16.33 Kraj: Črnuče
|
Objavljeno: Pon Jun 27, 2011 11:17 pm Naslov sporočila: |
|
|
Če ne rabiš analognih vhodov je nekdo napisal seznam ukazov za vse pice, kako se to izklopi. Povezava je nekje na Mikroelektronikinem forumu:
Zgleda takole:
| Koda: |
module all_digital
implements
sub procedure AllDigital()
#IFDEF P16 THEN
#IFDEF P12C671 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P12C672 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P12CE673 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P12CE674 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P12F609 THEN
CMCON0.7 = 0 ' turn off comparators
ANSEL = ANSEL and %11110100 ' turn off analog inputs
#ENDIF
#IFDEF P12F615 THEN
CMCON0.7 = 0 ' turn off comparators
ANSEL = ANSEL and %11110000 ' turn off analog inputs
#ENDIF
#IFDEF P12F629 THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P12F635 THEN
CMCON0 = CMCON0 or 0x07 ' turn off comparators
#ENDIF
#IFDEF P12F675 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ANSEL = ANSEL and %11110000 ' turn off analog inputs
#ENDIF
#IFDEF P12F683 THEN
CMCON0 = CMCON0 or 0x07 ' turn off comparators
ANSEL = ANSEL and %11110000 ' turn off analog inputs
#ENDIF
#IFDEF P12HV609 THEN
CMCON0.7 = 0 ' turn off comparators
ANSEL = ANSEL and %11110100 ' turn off analog inputs
#ENDIF
#IFDEF P12HV615 THEN
CMCON0.7 = 0 ' turn off comparators
ANSEL = ANSEL and %11110000 ' turn off analog inputs
#ENDIF
#IFDEF P16C432 THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16C433 THEN
ADCON1 = ADCON1 or 0x07
#ENDIF
#IFDEF P16C620 THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16C620A THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16C621 THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16C621A THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16C622 THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16C622A THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16C642 THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16C662 THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16C71 THEN
ADCON1 = ADCON1 or 0x03 ' turn off analog inputs
#ENDIF
#IFDEF P16C710 THEN
ADCON1 = ADCON1 or 0x03 ' turn off analog inputs
#ENDIF
#IFDEF P16C711 THEN
ADCON1 = ADCON1 or 0x03 ' turn off analog inputs
#ENDIF
#IFDEF P16C712 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16C715 THEN
ADCON1 = ADCON1 or 0x03 ' turn off analog inputs
#ENDIF
#IFDEF P16C716 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16C717 THEN
ANSEL = ANSEL and %11000000 ' turn off analog inputs
#ENDIF
#IFDEF P16C72 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16C72A THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16C73 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16C73A THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16C73B THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16C74 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16C745 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16C74A THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16C74B THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16C76 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16C765 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16C77 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16C770 THEN
ANSEL = ANSEL and %11000000 ' turn off analog inputs
#ENDIF
#IFDEF P16C771 THEN
ANSEL = ANSEL and %11000000 ' turn off analog inputs
#ENDIF
#IFDEF P16C773 THEN
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P16C774 THEN
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P16C781 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
#ENDIF
#IFDEF P16C782 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
#ENDIF
#IFDEF P16C924 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16C925 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P16C926 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P16CE623 THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16CE624 THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16CE625 THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16CR72 THEN
ADCON1 = ADCON1 or 0x07
#ENDIF
#IFDEF P16F610 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = ANSEL and %00001100 ' turn off analog inputs
#ENDIF
#IFDEF P16F616 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
#ENDIF
#IFDEF P16F627 THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16F627A THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16F628 THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16F628A THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16F630 THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16F631 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
#ENDIF
#IFDEF P16F636 THEN
CMCON0 = CMCON0 or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16F639 THEN
CMCON0 = CMCON0 or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16F648A THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16F676 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
#ENDIF
#IFDEF P16F677 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
ANSELH = ANSELH and %11110000 ' turn off analog inputs
#ENDIF
#IFDEF P16F684 THEN
CMCON0 = CMCON0 or 0x07 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
#ENDIF
#IFDEF P16F685 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
ANSELH = ANSELH and %11110000 ' turn off analog inputs
#ENDIF
#IFDEF P16F687 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
ANSELH = ANSELH and %11110000 ' turn off analog inputs
#ENDIF
#IFDEF P16F688 THEN
CMCON0 = CMCON0 or 0x07 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
#ENDIF
#IFDEF P16F689 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
ANSELH = ANSELH and %11110000 ' turn off analog inputs
#ENDIF
#IFDEF P16F690 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
ANSELH = ANSELH and %11110000 ' turn off analog inputs
#ENDIF
#IFDEF P16F716 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16F72 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16F73 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16F737 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P16F74 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16F747 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P16F76 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16F767 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P16F77 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
#ENDIF
#IFDEF P16F777 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P16F785 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL0 = 0 ' turn off analog inputs
ANSEL1 = ANSEL1 and %11110000 ' turn off analog inputs
#ENDIF
#IFDEF P16F818 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P16F819 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P16F87 THEN
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P16F870 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P16F871 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P16F872 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P16F873 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P16F873A THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P16F874 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P16F874A THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P16F876 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P16F876A THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P16F877 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P16F877A THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P16F88 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
#ENDIF
#IFDEF P16F882 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
ANSELH = ANSELH and %11000000 ' turn off analog inputs
#ENDIF
#IFDEF P16F883 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = ANSEL and %1110000 ' turn off analog inputs
ANSELH = ANSELH and %11000000 ' turn off analog inputs
#ENDIF
#IFDEF P16F884 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
ANSELH = ANSELH and %11000000 ' turn off analog inputs
#ENDIF
#IFDEF P16F886 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = ANSEL and %1110000 ' turn off analog inputs
ANSELH = ANSELH and %11000000 ' turn off analog inputs
#ENDIF
#IFDEF P16F887 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
ANSELH = ANSELH and %11000000 ' turn off analog inputs
#ENDIF
#IFDEF P16F913 THEN
CMCON0 = CMCON0 or 0x07 ' turn off comparators
ANSEL = ANSEL and %11100000 ' turn off analog inputs
#ENDIF
#IFDEF P16F914 THEN
CMCON0 = CMCON0 or 0x07 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
#ENDIF
#IFDEF P16F916 THEN
CMCON0 = CMCON0 or 0x07 ' turn off comparators
ANSEL = ANSEL and %11100000 ' turn off analog inputs
#ENDIF
#IFDEF P16F917 THEN
CMCON0 = CMCON0 or 0x07 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
#ENDIF
#IFDEF P16F946 THEN
CMCON0 = CMCON0 or 0x07 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
#ENDIF
#IFDEF P16HV610 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = ANSEL and %00001100 ' turn off analog inputs
#ENDIF
#IFDEF P16HV616 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
#ENDIF
#IFDEF P16HV785 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL0 = 0 ' turn off analog inputs
ANSEL1 = ANSEL1 and %11110000 ' turn off analog inputs
#ENDIF
#ELSE
#IFDEF P18F1220 THEN
ADCON1 = ADCON1 or %01111111 ' turn off analog inputs
#ENDIF
#IFDEF P18F1230 THEN
ADCON1 = ADCON1 and %10000000 ' turn off analog inputs
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P18F1320 THEN
ADCON1 = ADCON1 or %01111111 ' turn off analog inputs
#ENDIF
#IFDEF P18F1330 THEN
ADCON1 = ADCON1 and %10000000 ' turn off analog inputs
CMCON = CMCON or 0x07 ' turn off comparators
#ENDIF
#IFDEF P18F2220 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2221 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2320 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2321 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2331 THEN
ANSEL0 = ANSEL0 and %11100000 ' turn off analog inputs
#ENDIF
#IFDEF P18F2410 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F242 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P18F2420 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2423 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2431 THEN
ANSEL0 = ANSEL0 and %11100000 ' turn off analog inputs
#ENDIF
#IFDEF P18F2439 THEN
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2450 THEN
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2455 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2458 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F248 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P18F2480 THEN
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F24J10 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F24K20 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = ANSEL and %1110000 ' turn off analog inputs
ANSELH = ANSELH and %11100000 ' turn off analog inputs
#ENDIF
#IFDEF P18F2510 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2515 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F252 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P18F2520 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2523 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2525 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2539 THEN
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2550 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2553 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F258 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P18F2580 THEN
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2585 THEN
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F25J10 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F25K20 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = ANSEL and %1110000 ' turn off analog inputs
ANSELH = ANSELH and %11100000 ' turn off analog inputs
#ENDIF
#IFDEF P18F2610 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2620 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2680 THEN
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2682 THEN
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F2685 THEN
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F26K20 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = ANSEL and %1110000 ' turn off analog inputs
ANSELH = ANSELH and %11100000 ' turn off analog inputs
#ENDIF
#IFDEF P18F4220 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4221 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4320 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4321 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4331 THEN
ANSEL0 = 0 ' turn off analog inputs
ANSEL1.0 = 0 ' turn off analog inputs
#ENDIF
#IFDEF P18F4410 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F442 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P18F4420 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4423 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4431 THEN
ANSEL0 = 0 ' turn off analog inputs
ANSEL1.0 = 0 ' turn off analog inputs
#ENDIF
#IFDEF P18F4439 THEN
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4450 THEN
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4455 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4458 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F448 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P18F4480 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F44J10 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F44K20 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
ANSELH = ANSELH and %11100000 ' turn off analog inputs
#ENDIF
#IFDEF P18F4510 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4515 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F452 THEN
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P18F4520 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4523 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4525 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4539 THEN
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4550 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4553 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F458 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x07 ' turn off analog inputs
ADCON1.3 = 0
#ENDIF
#IFDEF P18F4580 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4585 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F45J10 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F45K20 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
ANSELH = ANSELH and %11100000 ' turn off analog inputs
#ENDIF
#IFDEF P18F4610 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4620 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4680 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4682 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F4685 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F46K20 THEN
CM1CON0.7 = 0 ' turn off comparators
CM2CON0.7 = 0 ' turn off comparators
ANSEL = 0 ' turn off analog inputs
ANSELH = ANSELH and %11100000 ' turn off analog inputs
#ENDIF
#IFDEF P18F6310 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6390 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6393 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F63J11 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F63J90 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6410 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6490 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6493 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F64J11 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F64J90 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6520 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6525 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6527 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6585 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F65J10 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F65J11 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F65J15 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F65J50 THEN
ANCON0 = ANCON0 or %10011111 ' turn off analog inputs
ANCON1 = ANCON1 or %00001100 ' turn off analog inputs
#ENDIF
#IFDEF P18F65J90 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6620 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6621 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6622 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6627 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6628 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6680 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F66J10 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F66J11 THEN
ANCON0 = ANCON0 or %11011111 ' turn off analog inputs
ANCON1 = ANCON1 or %00001111 ' turn off analog inputs
#ENDIF
#IFDEF P18F66J15 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F66J16 THEN
ANCON0 = ANCON0 or %11011111 ' turn off analog inputs
ANCON1 = ANCON1 or %00001111 ' turn off analog inputs
#ENDIF
#IFDEF P18F66J50 THEN
ANCON0 = ANCON0 or %10011111 ' turn off analog inputs
ANCON1 = ANCON1 or %00001100 ' turn off analog inputs
#ENDIF
#IFDEF P18F66J55 THEN
ANCON0 = ANCON0 or %10011111 ' turn off analog inputs
ANCON1 = ANCON1 or %00001100 ' turn off analog inputs
#ENDIF
#IFDEF P18F66J60 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F66J65 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6720 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6722 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F6723 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F67J10 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F67J11 THEN
ANCON0 = ANCON0 or %11011111 ' turn off analog inputs
ANCON1 = ANCON1 or %00001111 ' turn off analog inputs
#ENDIF
#IFDEF P18F67J50 THEN
ANCON0 = ANCON0 or %10011111 ' turn off analog inputs
ANCON1 = ANCON1 or %00001100 ' turn off analog inputs
#ENDIF
#IFDEF P18F67J60 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8310 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8390 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8393 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F83J11 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F83J90 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8410 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8490 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8493 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F84J11 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F84J90 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8520 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8525 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8527 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8585 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F85J10 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F85J11 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F85J15 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F85J50 THEN
ANCON0 = ANCON0 or %10011111 ' turn off analog inputs
ANCON1 = ANCON1 or %11111100 ' turn off analog inputs
MEMCON.7 = 1 ' disable external memory bus
#ENDIF
#IFDEF P18F85J90 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8620 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8621 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8622 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8627 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8628 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8680 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F86J10 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F86J11 THEN
ANCON0 = ANCON0 or %11011111 ' turn off analog inputs
ANCON1 = 255 ' turn off analog inputs
MEMCON.7 = 1 ' disable external memory bus
#ENDIF
#IFDEF P18F86J15 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F86J16 THEN
ANCON0 = ANCON0 or %11011111 ' turn off analog inputs
ANCON1 = 255 ' turn off analog inputs
MEMCON.7 = 1 ' disable external memory bus
#ENDIF
#IFDEF P18F86J50 THEN
ANCON0 = ANCON0 or %10011111 ' turn off analog inputs
ANCON1 = ANCON1 or %11111100 ' turn off analog inputs
MEMCON.7 = 1 ' disable external memory bus
#ENDIF
#IFDEF P18F86J55 THEN
ANCON0 = ANCON0 or %10011111 ' turn off analog inputs
ANCON1 = ANCON1 or %11111100 ' turn off analog inputs
MEMCON.7 = 1 ' disable external memory bus
#ENDIF
#IFDEF P18F86J60 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F86J65 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8720 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8722 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8722b THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F8723 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F87J10 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F87J11 THEN
ANCON0 = ANCON0 or %11011111 ' turn off analog inputs
ANCON1 = 255
MEMCON.7 = 1 ' disable external memory bus
#ENDIF
#IFDEF P18F87J50 THEN
ANCON0 = ANCON0 or %10011111 ' turn off analog inputs
ANCON1 = ANCON1 or %11111100 ' turn off analog inputs
MEMCON.7 = 1 ' disable external memory bus
#ENDIF
#IFDEF P18F87J60 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F96J60 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F96J65 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18F97J60 THEN
CMCON = CMCON or 0x07 ' turn off comparators
MEMCON.7 = 1 ' disable external memory bus
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18LF24J10 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18LF25J10 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18LF44J10 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#IFDEF P18LF45J10 THEN
CMCON = CMCON or 0x07 ' turn off comparators
ADCON1 = ADCON1 or 0x0F ' turn off analog inputs
#ENDIF
#ENDIF
end sub
end.
|
Najdi svoj čip in prepiši. Če še kaj rabiš pa le napiši. Se tudi sam največkrat ukvarjam ravno s tem čipom. _________________ If at first you don't succeed, destroy all evidence that you tried. |
|
| Nazaj na vrh |
|
 |
SIMON ZORKO Član

Pridružen-a: Pet 19 Sep 2008 11:20 Prispevkov: 14 Aktiv.: 0.07 Kraj: zg.Volicina
|
Objavljeno: Tor Jun 28, 2011 12:27 am Naslov sporočila: |
|
|
Highlag hvala za pomoč. Zelo uporabna zadeva bom vpisal v program in preizkusil delovanje upam da bo termometer deloval.
Sem vpisal ukaze za izklopitev analognih vhodov v program. Nastavil sem nastavitve mikrokontrolerja XT oscilator, 4 Mhz takt, WDT off, vse zaščite pred branjem sem izklopil. Pri vnosu hex datoteke v PIC 16F876A sem naletel na težavo. Noče mi vpisati konfiguracijskega stavka v mikrokontroler. Druge programe napisane v asemblerju mi vpiše brez problema. Uporabljam programator velleman k8048.
Hvala za odgovore. |
|
| Nazaj na vrh |
|
 |
|
|
Ne, ne moreš dodajati novih tem v tem forumu Ne, ne moreš odgovarjati na teme v tem forumu Ne, ne moreš urejati svojih prispevkov v tem forumu Ne, ne moreš brisati svojih prispevkov v tem forumu Ne ne moreš glasovati v anketi v tem forumu Ne, ne moreš pripeti datotek v tem forumu Ne, ne moreš povleči datotek v tem forumu
|
Uptime: 232 dni
Powered by phpBB © 2001, 2005 phpBB Group
|