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

Displaying an analog signal on a lcd

Heys guys,just writing some code to display an analog signal on a lcd,below I've wrote some code to take in analog signal and display its result on port 2.So now I guess instead of display it on port 2 I want display it on the lcd.So just wondering can I manipulate the signal going into AD0DAT1 register in order to display it on the lcd?

# include <REG935.H>

void main()
{

        P2M1=0x00;                               //output
        P2M2=0x00;

        P1M1=0x00;                                       //lcd
        P1M2=0x00;

        P0M1=0xFF;                                //set as input for analog signal
        P0M2=0x00;

        ADINS=0x02;                               //set ad01(P0.0) for sampling
        ADCON0=0X04;                      //ADC channel 0 enabled
        ADMODB=0x40;                      //sets to divide by 3,for accuracy
        ADMODA=0x02;    //fixed channel,continous conversion,until terminated by user

        while(1)
        {
                ADCON0 |= 0x01;                 //start conversion,immediate start mode
                while((ADCON0 & 0x08) == 0);        //wait for end of conversion
                ADCON0 &= 0xF7;                     //clear EOC flag
                P2 = AD0DAT1;                   //output result on to port 2
       }
}

Parents
  • What does your spider senses tell you?

    Doesn't the type of LCD and the way it is interfaced drastically change what code you need to present information on it? How are we expected to know what hardware you have? or if you have a text panel where you want to display the ADC value as digits (0.15V) or maybe a graphical panel where you want to plot the ADC value as a curve over time? Or maybe just let the ADC value control the length of a bar on the display?

Reply
  • What does your spider senses tell you?

    Doesn't the type of LCD and the way it is interfaced drastically change what code you need to present information on it? How are we expected to know what hardware you have? or if you have a text panel where you want to display the ADC value as digits (0.15V) or maybe a graphical panel where you want to plot the ADC value as a curve over time? Or maybe just let the ADC value control the length of a bar on the display?

Children