hello all,
I m working with AT89C51CC01.
I write ADC program as follows.
#include <stdio.h>
#include "reg_c51.h"
// standard conversion
// The variable "channel" contains the channel to convert
// The variable "value_converted" is an unsigned int
#define channel P1_7 // ADC i/p
#define value_converted P0 // ADC o/p
void main()
{
ADCF = 0x80; // configure channel P1.7 for ADC
ADCON = 0x20; // Enable the ADC
ADCON &= 0xF8; // Clear the field SCH[2:0]
ADCON |= channel; // Select channel
ADCON |= 0x08; // Start conversion in standard mode
// Wait flag End of conversion
while((ADCON & 0x01)!= 0x01)
{
ADCON &= 0xEF;// Clear the End of conversion flag
// read the value
value_converted = (ADDH << 2)+(ADDL);
}
while (1)
{}
}
In this program my analog i/p pin is p1_7 and o/p port is P0.
I can give analog i/o through P1_7 pin but no o/p given by port P0.
I don´t know why?
I have clearly write
value_converted = (ADDH << 2)+(ADDL);
#define value_converted P0 // ADC o/p
then why this program not give o/p?
Please check this program.
Tell me ur idea or sugestion for this problem.
Thanks in advance.