Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interfacing LM35, ADC0804 , and AT89C51 (8051) in MIKROC for 8051 help ?

Status
Not open for further replies.

Shamooooot

Newbie level 6
Joined
Jan 1, 2013
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,420
I am trying to read the temperature value on a LM35 sensor via ADC0804 to AT89C51
this is my code in mikroc:

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// LCD module connections
 
char OW_val;
sbit LCD_RS at P0_2_bit;
sbit LCD_EN at P2_3_bit;
 
sbit LCD_D4 at P2_4_bit;
sbit LCD_D5 at P2_5_bit;
sbit LCD_D6 at P2_6_bit;
sbit LCD_D7 at P2_7_bit;
// End LCD module connections
 
sbit OW_Bit1 at P1_0_bit;
sbit OW_Bit2 at P1_1_bit;
sbit OW_Bit3 at P1_2_bit;
sbit OW_Bit4 at P1_3_bit;
sbit OW_Bit5 at P1_4_bit;
sbit OW_Bit6 at P1_5_bit;
sbit OW_Bit7 at P1_6_bit;
sbit OW_Bit8 at P1_7_bit;
 
char txt3[] = "Jordan university";
char txt4[] = "of science";
char txt5[] = "and technology";
 
void main(){
 
  Lcd_Init();                  // Initialize LCD
  Lcd_Cmd(_LCD_CLEAR);         // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF);    // Cursor off
  LCD_Out(1,1,txt3);           // Write text in first row
  LCD_Out(2,3,txt4);           // Write text in second row
  Delay_ms(1000);
  Lcd_Cmd(_LCD_CLEAR);
  LCD_Out(1,2,txt5);
  Delay_ms(1000);
  Lcd_Cmd(_LCD_CLEAR);
  OW_val = OW_read(0);
  LCD_Out(1,1,OW_val);
}


the program shows me error with the OW_read() I think it's not a valid command, and I don't know how can I read the input bits on the input pins to be shown on the LCD in Celsius.
here is my ckt:
 

Thanks gelectron and arunsharma0731..
I kinda know how ADC works and I am fine when it comes to LCD 8051 interfacing, but what really concerns me is how can I define the input to the microcontroller for example telling the microcontroller that the temperature is 27 C degree ??
 

Where is your Code for ADC read ?
How to convert it (LM35 values ) to ASCI

The LM35 has a scale factor of 10mV per 1oC, so the range of temperature set was between 0 oC and 100 oC. The LM35 would give a total output voltage 1v since every degree has a value of 10mv and so a range of 0 to 1V. This means that when the temperature is 0 oC then the output voltage is 0V. At 100 oC * 10mV = 1V (o/p voltage).

Look here https://sites.google.com/site/controlandelectronics/interface-lm35-with-8051-adc
 

    V

    Points: 2
    Helpful Answer Positive Rating
Well !! do the ADC_read statement work with 8051 (I know that it doesn't has an internal A/D converter ??) ? and if it is work how can I read all the inputs from P1.0 to P1.7 and write a code to combine these bits and convert them to decimal value. I think there's a lack of info's and examples about 8051 microcontroller on the web...
 

No there is no ADC in 8051 and there is no ADC read function in mikroC 8051. You have to write your own ADC read routine if you use 8051 and some adc like 0804 or 0809.
 

Can anybody give me any example about how to write this routine ??? or how even to start this as I don't know anything but the ADC_read() to read the input pins for a certain microcontroler....
Thanks all...
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top