This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

somebody help me with program.

can somebody help me with the following programs.if possible write comments on all lines.i cannot understand it.The project is a transmitter with adc having 3 inputs.The following is transmitter code.

#include <REGX51.H>       // standard 8051 defines
#include <stdio.h> // printf
#include "adc.h"
#include "utils.h"
sfr RFPORT = P0;
sbit RF1 = P3;
  sbit BUZZER = P1^6;
  void main()
{

 BUZZER = 0;
// -=-=- Intialise -=-=-=
        initADC();

// -=-=- Program Loop -=-=-=
        while(1)
        {

                RFPORT = getADC(1);
                delayms(50);
                RF1 = 0;
                delayms(250);
                RF1 = ADC(1);
                delayms(1000);


                RFPORT = getADC(2);
                delayms(50);
                RF1= 0;
                delayms(250);
                RF1 = ADC(2);
                delayms(1000);


                RFPORT = getADC(3);
                delayms(50);
                RF1 = 0;
                delayms(250);
                RF1 = ADC(3);
                delayms(1000);


}
        }


and this is the reciever code

#include <REGX51.H>       // standard 8051 defines
#include <stdio.h> // printf

// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// -=-=-=-=-  Include files    -=-=-=-=-=-=-=
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include "serialio.h"
#include "utils.h"

// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// -=-=-=-=-  Hardware Defines -=-=-=-=-=-=-=
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
sfr RFPORT = 0x80; //P0
sbit BUZZER=P1^5;
sbit RF1 = P0;

sbit LED = P1^4;


// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// -=-=-=-=-  Variables        -=-=-=-=-=-=-=
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
unsigned char adc1, adc2, adc3, adc4;


}
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// -=-=-=-=-  Main Program     -=-=-=-=-=-=-=
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void main()
{
// -=-=- Intialize variables -=-=-=

                BUZZER = 0;
                LED = 1;
// -=-=- Intialise -=-=-=
        serialInit();

// -=-=- Program Loop -=-=-=
        adc1=0; adc2=0;adc3=0;
        while(1)
{
                if(RF1 == adc1)
                        print ( putchr adc1);
                {
                        LED = 0;
                        adc1 = ~RFPORT;

                }


        if(RF1 == adc2)
                        print ( putchr adc2);
        {
                        LED = 0;
                        adc1 = ~RFPORT;

        }

        if(RF1 == adc3)
                        print ( putchr adc3);
                {
                        LED = 0;
                        adc1 = ~RFPORT;
                }
}

0