Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 4923

PIC16F1939 - problem with adc and pot

$
0
0
Hi I'm trying to test the adc on a picf161939. I have followed the adc procedure but its not working. I am measuring an analog value from a pot and sending the adresh and adresl to port c and d with led's on it.

At the outputs of portc and d I am getting a random sequence.

I assume the code is wrong but can't see where I've gone wrong.
Code (Text):
  1. #include <pic16f1939.h>
  2. #include <xc.h>
  3. #define _XTAL_FREQ 500000 //1ms delay
  4.  
  5. void main()
  6. {
  7.     PORTC = 0; PORTD = 0;
  8.     LATC = 0; LATD = 0;...
PIC16F1939 - problem with adc and pot

Viewing all articles
Browse latest Browse all 4923

Trending Articles