Hi, I am a new comer to the field of microcontrollers and doing some simple projects to get familiar with microcontrollers. Currently i am embarking on using the AT89C4051 as an ADC . I am actually trying to use the application notes provided by the following website: h**p://www.atmel.com/dyn/resources/prod_documents/DOC0524.PDF It would be very useful if someone were to help me with the coding (C-program) for the application. I have tried a few times but have failed. Your help would be greaatly appreciated. I have done the conections for the ADC conversion and had connected the positive voltage of the signal to Pin 1.1. and i wrote a very simple program, that would be able to output voltage reading on the LEDs,. The program is of as follows:
#include<AT89x051.h>
char a[10]={0x03,0x13,0x23,0x33,0x43,0x53,0x63,0x73,0x83,0x93}; /* The numbering from 0-9*/
void main(void)
{int j, adc_data; while(1){
P1_1=adc_data; P1=a[adc_data%10]; for(j=0;j<30000;j++);
} }
I do always get a zero on my LED display, no matter how i changed the voltage input, Could someone please help.I am struggling with this for a few days. Thank you
|