PIC16F877A LM35/LM36 Temperature sensor interface using MikroC coding
Hello Ladies and Gentlemen,
This video is about how to interface a LM 35 temperature sensor with PIC16f877A with full coding support. If you still have any problem let me know. Always happy to help.
Here is the code:
// Lcd pinout settings
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D7 at RB5_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D4 at RB2_bit;
// Pin direction
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D7_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB2_bit;
int vref = 5 ; // its your applied voltage change if 3.3 or 3.7 etc
int tmp; // intialzie variable int as tmp
int temp_celcius;
char tmp1[3]; // intialize char to store a string of 3 chars
void main() {
LCD_Init(); //Intializes the LCD modules
DElay_ms(250);
ADC_Init(); // Initializes the ADC Module for ADC Conversions
Delay_ms(250);
LCD_OUT(1,1, " Learning ");// LCD Will display at row 1 column 1 Learning.
LCD_OUT(2,2, "Microcontrollers"); // LCD Will display at row column 2 Microcontrollers.
Delay_ms(3200); // Will display this for 2 seconds
Lcd_Cmd(_LCD_CLEAR); // Will clear LCD for new valuse to be displayed
while(1) // Needed for operations its an internal loop which keeps on executing
{
tmp = ADC_Read(0); // ADC read from pin AN 0
Delay_ms(50);
temp_celcius = ( tmp * vref )/ 10 ;
delay_ms(20);
IntToStr(temp_celcius, tmp1);// will convert values of tmp to tmp1
delay_ms(20);
// Now we can display this string on LCD
Lcd_Cmd(_LCD_CLEAR); // Precaution clear for readings to be displayed
LCD_OUT(1,1, "Temp = ");
LCD_OUT(1,10,tmp1); // I changed column number to display result after above helping string
Delay_ms(800); // Keep displaying same value for 0.5 sec
Lcd_Cmd(_LCD_CLEAR); // Then clear LCD for new values
}
}
Видео PIC16F877A LM35/LM36 Temperature sensor interface using MikroC coding канала Learning Microcontrollers
This video is about how to interface a LM 35 temperature sensor with PIC16f877A with full coding support. If you still have any problem let me know. Always happy to help.
Here is the code:
// Lcd pinout settings
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D7 at RB5_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D4 at RB2_bit;
// Pin direction
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D7_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB2_bit;
int vref = 5 ; // its your applied voltage change if 3.3 or 3.7 etc
int tmp; // intialzie variable int as tmp
int temp_celcius;
char tmp1[3]; // intialize char to store a string of 3 chars
void main() {
LCD_Init(); //Intializes the LCD modules
DElay_ms(250);
ADC_Init(); // Initializes the ADC Module for ADC Conversions
Delay_ms(250);
LCD_OUT(1,1, " Learning ");// LCD Will display at row 1 column 1 Learning.
LCD_OUT(2,2, "Microcontrollers"); // LCD Will display at row column 2 Microcontrollers.
Delay_ms(3200); // Will display this for 2 seconds
Lcd_Cmd(_LCD_CLEAR); // Will clear LCD for new valuse to be displayed
while(1) // Needed for operations its an internal loop which keeps on executing
{
tmp = ADC_Read(0); // ADC read from pin AN 0
Delay_ms(50);
temp_celcius = ( tmp * vref )/ 10 ;
delay_ms(20);
IntToStr(temp_celcius, tmp1);// will convert values of tmp to tmp1
delay_ms(20);
// Now we can display this string on LCD
Lcd_Cmd(_LCD_CLEAR); // Precaution clear for readings to be displayed
LCD_OUT(1,1, "Temp = ");
LCD_OUT(1,10,tmp1); // I changed column number to display result after above helping string
Delay_ms(800); // Keep displaying same value for 0.5 sec
Lcd_Cmd(_LCD_CLEAR); // Then clear LCD for new values
}
}
Видео PIC16F877A LM35/LM36 Temperature sensor interface using MikroC coding канала Learning Microcontrollers
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
![LM35 Temperature Sensor with PIC16F877A | Digital Thermometer](https://i.ytimg.com/vi/_Y8th_sheCU/default.jpg)
![PIC16F877A DC MOTOR](https://i.ytimg.com/vi/sqk3yD2mSGg/default.jpg)
![PIC16F877A/PIC16F887/PIC16F****/PIC18F/*** Interface With LDR sensor using MikroC coding](https://i.ytimg.com/vi/BjZoVGgFHjQ/default.jpg)
![PIC16F877A/PIC16F887/18F**** interface with Water level sensor (mini project) using MikroC](https://i.ytimg.com/vi/AIGsCcdohqM/default.jpg)
![Interfacing a PIC microcontroller with an LCD](https://i.ytimg.com/vi/pyb-X1Uogr4/default.jpg)
![LM35 Temperature Sensor with Arduino Uno](https://i.ytimg.com/vi/3Xc2sPhwWEc/default.jpg)
![Interfacing a PIC16F887 with an LCD panel](https://i.ytimg.com/vi/9PJJcQGwLd8/default.jpg)
![BUILDING DIGITAL THERMOMETER (LM35) USING PIC16F877A | TUTORIAL 22 | MPLAB IDE PROGRAMMING COURSE](https://i.ytimg.com/vi/MnXsXjUby-Q/default.jpg)
![PIC16F877A/PIC16F887/18F**** interface Wireless sensor using Cheap 433MHZ RF modules and LDR](https://i.ytimg.com/vi/mEIW7FDacWE/default.jpg)
![PIC16F877A/PIC16F887/PIC16/18F*** interface CH340 USB to TTL device](https://i.ytimg.com/vi/CbY_xGGcOSs/default.jpg)
![LM35 Temperature Sensor With Arduino Guide and Project](https://i.ytimg.com/vi/k099LBmwcgE/default.jpg)
![Temperature Sensor(LM35) and Light sensor Interfacing with PIC18F4550](https://i.ytimg.com/vi/I4GCUC0i--Q/default.jpg)
![Design PIC16F877A development board PCB using Proteus](https://i.ytimg.com/vi/lmTGRa4RLjw/default.jpg)
![Setting up a PIC16F877A](https://i.ytimg.com/vi/CNwoRa1Lk3U/default.jpg)
![Mesure de température sur PIC18F45K50 avec un LM35 et un LM4040](https://i.ytimg.com/vi/LnOCSOd7DGw/default.jpg)
![Q11: Temperature sensor LM35 + LCD + Pic16f877](https://i.ytimg.com/vi/lKFR6h9t7hs/default.jpg)
![PIC16F877A a basic Introduction](https://i.ytimg.com/vi/e4pA_6ucHTc/default.jpg)
![PIC16F877A/PIC16F887/PIC16/18F**** interface with Radio Frequency (RF) modules 433Mhz](https://i.ytimg.com/vi/K0iMGIrSDIc/default.jpg)
![PIC Ders-24 (Sıcaklık Sensörü Uygulaması / Analog Port Kullanımı)](https://i.ytimg.com/vi/p8F3xBAZ4rE/default.jpg)
![Interfacing 16x2 LCD with PIC16F877A microcontroller](https://i.ytimg.com/vi/j20d4HLKgR8/default.jpg)