CCS is case insensitive by default, so port_B == PoRt_b. Don't be like me and develop bad habits with a case insensitive compiler, try to be consistent about capitalization. Yes, you need to explicilty define port_b. #byte port_b = 6 and also, you've defined "value" as a long. You may get unexpected results by assigning a port (8 bit) to a long (16 bit in CCS). If you explicitly state in your include file, #DEVICE pic16f877 ADC=10 then read_ADC() will give you a long, packed with the two most signifigant bits in the upper byte. To convert the 10-bit value to 8 bits you may need to shift right twice to truncate it to 8 bits. --Lawrence -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body