----- Original Message ----- From: To: Sent: Monday, February 07, 2000 11:00 AM Subject: First Project with PIC16F87x doesn't work > Hi All, > My first project with the PIC16F87X doesn't work. I am simply trying to do a > conversion A/D in the PORTA0 and show it in PORTB with leds.Also a led > blinking in the PORTC6 using TMRO overflow. I'm using a 4MHZ cristal. I can't offer much advice on getting your particular code to work but since I'm new to pics as well and I was using the 16F876, the demo A/D code I finally got working after much struggle should work for you to get you started at least. I didn't use a crystal for my test, just the external RC connection, but I did get my program to do A/D on port A0 and show the left justified highest 8 bits on port B if you can use it at all. I modified a demo file that came wth MPlab for the 877 chip and here's my result: ;********************************************************** ;* This program configures the A/D Module to convert on ;* A/D channel 0 and display the results on the LEDS on PORTC. ;* Code modified from MPlab demo file for experimental use ;********************************************************** list p=16f876 include "p16f876.inc" org 0x000 nop Start banksel PORTC clrf PORTC ;Clear PORTC movlw B'11000001' ;RC, A/D enabled movwf ADCON0 banksel OPTION_REG movlw B'10000111' ;TMR0 prescaler, 1:256 movwf OPTION_REG clrf TRISC ;PORTC all outputs movlw B'00001110' ;Left justify,1 analog channel movwf ADCON1 ;VDD and VSS references banksel PORTC Main bsf ADCON0,GO ;Start A/D conversion Wait btfss PIR1,ADIF ;Wait for conversion to complete goto Wait movf ADRESH,W ;Write A/D result to PORTC movwf PORTC goto Main ;Do it again end