Documente Academic
Documente Profesional
Documente Cultură
// Iniilizare convertor
void main()
{
DDRB = 0xFF;
DDRC = 0xFF;
PORTB = adc_rd;
PORTC = Hi(adc_rd);
int T;
char ppm;
UART1_Init(9600);
9600
Delay_ms(2000);
iniializa USART
ADC_Init();
convertor
while (1) {
adc_rd = ADC_Read(2);
canalul 2
T = adc_rd;
pus n T
22
MICROCONTROLERE
UART1_Write(T);
doua placa a valorii din T
//Trimitere catre a
Delay_ms(500);
}
LCD_RS at PORTD2_bit;
LCD_EN at PORTD3_bit;
LCD_D4 at PORTD4_bit;
LCD_D5 at PORTD5_bit;
LCD_D6 at PORTD6_bit;
LCD_D7 at PORTD7_bit;
LCD_RS_Direction at DDD2_bit;
LCD_EN_Direction at DDD3_bit;
LCD_D4_Direction at DDD4_bit;
LCD_D5_Direction at DDD5_bit;
LCD_D6_Direction at DDD6_bit;
LCD_D7_Direction at DDD7_bit;
#defineLcdD0
firul de date D0 de
#defineLcdD1
firul de date D1 de
#define LcdD2
firul de date D2 de
#define LcdD3
firul de date D3 de
#define LcdD4
date D4 de pe LCD
#define LcdD5
date D5 de pe LCD
//Declarare display
PA0
// Pinul pentru
PA1
// Pinul de pe
PA2
// Pinul de pe
PA3
// Pinul de pe
pe LCD
pe LCD
pe LCD
pe LCD
PA4
PA5
MICROCONTROLERE
#define LcdD6
date D6 de pe LCD
#define LcdD7
date D7 de pe LCD
PA6
PA7
#define LcdRS
selectare operaie (LCD)
#define LcdRW
Write (LCD)
#define LcdE
(LCD)
PB0
// Pinul pentru
PB1
PB2
// Pinul de Enable
//Initializam pinul de
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,txt1);
primul rnd
//Iniializare LCD
// Clear display
// Scriem textul n
while(1)
{
24
MICROCONTROLERE
if (UART1_Data_Ready() == 1) {
// Dac s-a citit
ceva trecem mai departe
x=UART1_Read();
//Introducem
informaia din USART n x
Lcd_Out(2,5,x);
//Afim pe LCD, rnd 2
coloana 1, valoarea lui x
}
}
}
while(x>500ppm)
Sound_Play(10000, 30000);
= 30s
Sound_Init(&PORTB,5);
Costul
Senzorul de gaz Figaro TSS813 84,00 RON
Microcontroleru Atmega 16 164,40 RON
LCD 23,74 RON
Convertor max 232 ( placa de expansiune) 32,90 RON
Mufa RS232 2,00 RON ( x2=4,00 RON)
25
MICROCONTROLERE
26