Using ccs compiler and in circuit emulator I have run the program below on my PIC16f877 without success! What I want to achieve is to output the lower 8bit result(contained in adresl register) of the A2D conversion onto port B where 8 leds are connected. Does anyone know what I am doing wrong? > #include<16F877.h> > #use delay(clock=20000000) > #byte port_b = 6 #byte adresl = 9E #use fast_io(b) > > void main (void) > { > long value; int lowvalue; > > setup_adc_ports(RA0_ANALOG_RA3_REF); > setup_adc( ADC_CLOCK_INTERNAL ); > set_adc_channel( 0 ); > set_tris_b(0); > do { > value = Read_ADC(); > delay_ms(100); > lowvalue = adresl > port_b = lowvalue; > } while (TRUE); > } Dean Matthews -----Original Message----- From: Dale Botkin [mailto:dale@BOTKIN.ORG] Sent: 15 November 2001 13:31 To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]: adresh&adresl registers. > > Can anyone tell me if I can access adresh and adresL registers direct > after an a2d conversion, and output the contents of both registers > onto an output port. > > eg. value = adresh; > value1= adresl; > port_b=value; > port_c=value1; Yup, should work. Dale -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body