Paul Chicofsky wrote: > > Hi Tony, > How are you? I was wondering if you have time to look at my code > that i attached with this e-mail. That would be appreciated so much. > I have put > '----->' as a mark where i didn't understand what would happen. Can > you please take a look at it and tell me if the code is right. Thank > you very much > > Regards, > Paul MOVF ADRESH,W ; Fetch the A/D result ----> ; How am i going to get this regester since it is 10 bits register ----> ; i mean would i get the 8 low bits or the 8 high bits because i am ----> ; consern about the 8 high bits i don't care about the 2 low bits Set the ADFM bit in the ADCON1 register to 0 so that the A2D result is left justified. The upper 8 bits of the 10 bit result will be in ADRESH. You can ignore the lower 2 bits in ADRESL. > call $ This will really put the stack in a spin :-) Try here goto here There's probably no need to initialise all ports etc to zero and then call 'pic_init' that changes them again straight away. Just call 'pic_init' and the jobs done. I wouldn't rely on the first A2D reading as you have tried to do it only micro seconds after the PIC is turned on. Try waiting a few mS at least so the port pins get a chance to settle down. -- Best regards Tony mICro's http://www.picnpoke.com mailto:sales@picnpoke.com -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics