source=3Dhere is a better version of the code.=20 list p=3D16f877a include "p16f877a.inc" __config _LVP_OFF & _XT_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF & = _BODEN_OFF & _DEBUG_OFF ;***** VARIABLE DEFINITIONS CBLOCK H'0C' Throttle ; var for storing a2d result=20 status_temp ; variable used for context saving ENDC=20 ; Start at the reset vector org 0x000 goto Start org 0x004 Interrupt retfie Start bsf STATUS,RP0 ;bank 1 bcf STATUS,RP1 movlw H'00' movwf TRISB ^ 0x080 ;portb [7-0] outputs movwf TRISC ^ 0x080 ;portc [7-0] outputs clrf ADCON1 ^ 0x080 ;left justified, all inputs a/d bcf STATUS,RP0 ;bank 0 movlw B'01000001' ;Fosc/8 [7-6],A/D ch0 [5-3],a/d on 0 movwf ADCON0 movlw B'01000001' ; LEDs movwf PORTB ;LEDs Main call ad_portc goto Main ad_portc nop =20 nop bsf ADCON0,GO ;Start A/D conversion Wait btfsc ADCON0,GO ;Wait for conversion to complete goto Wait movf ADRESH,W ;Write A/D result to PORTC movwf PORTC ;LEDs movwf Throttle =20 movlw D'55' addwf Throttle,W btfss status,C FALSE goto false_10 TRUE bsf PORTB,0 GOTO continue_10 false_10 bcf PORTB,0 continue_10 return end http://www.piclist.com/piclist/2003/10/16/174204a.txt? --- =20 http://www.piclist.com/member/jvitale-cnrit- PIC/PICList FAQ: http://www.piclist.com -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.