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 } }
The LCD I would be using would be a 16x2 alphanumeric,I will upload a picture of how I'm connecting it soon hopefully
The link below is currently how I'm trying to simulate the lcd in code http://omg.wthax.org/lcd.jpg
So how do you intend to display the analogue value: as a bargraph? as a numeric sample value? or what??
As a numeric value
So it's just a question of displaying a numeric value on a text display.
Where, exactly, are you stuck with this?
No its more a case I want to display the analog value I'm sampling on the lcd. But in order to do this I think I may have to convert the value to ASCII in order to display it on the lcd.
Of course you will - it's a text display!
The source of the number is irrelevant.
im stuck at a similar point, as any one got any useful info, like how to convert it to ASCII
Any decent 'C' textbook will describe the functions available in the standard 'C' library...
You can then check specific implementation details in the Keil manuals:
http://www.keil.com/support/man/docs/c51/c51_library.htm