it's left justified and i only use the high byte. the low byte is never in my code. through the port c leds i can see that the a2d is working fine. it's just that when i go to use the a2d value in the ADDWF statement the carry is not working. in essence the carry bit is being put out to portb pin 0 and lighting an led. once i get 201 on the a2d reading this led goes on as it should. when it hits 208 it goes off. then comes back on at 217 as i describe in the post. thanks for your interest, this is really killing me. i had the same problem a few months ago with the 16F84 when i was reading a square wave pulse from a radio control receiver. i thought it was my code but i am getting the same kind of problem again. any other info i will be glad to provide. thanks a bunch, jeff ----- Original Message ----- From: "Ken Pergola" To: Sent: Thursday, October 16, 2003 3:42 PM Subject: Re: [PIC]: a2d problems with 16f877a > Hi Jeff, > > Before spending any time studying your code, I have a quick question: > > In your code, what is the ADFM bit set to in register ADCON1? > > ADCON1 bit 7 -- ADFM: A/D Result Format Select bit > 1 = Right justified. 6 Most Significant bits of ADRESH are read as 0 . > 0 = Left justified. 6 Least Significant bits of ADRESL are read as 0 . > > Regards, > > Ken Pergola > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.