0% found this document useful (0 votes)
4 views

code

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

code

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

sbit LCD_RS at RB0_bit;

sbit LCD_EN at RB1_bit;

sbit LCD_D4 at RB2_bit;

sbit LCD_D5 at RB3_bit;

sbit LCD_D6 at RB4_bit;

sbit LCD_D7 at RB5_bit;

sbit LCD_RS_Direction at TRISB0_bit;

sbit LCD_EN_Direction at TRISB1_bit;

sbit LCD_D4_Direction at TRISB2_bit;

sbit LCD_D5_Direction at TRISB3_bit;

sbit LCD_D6_Direction at TRISB4_bit;

sbit LCD_D7_Direction at TRISB5_bit;

int time_count = 0;

char txt[10];

void main() {

TRISD.B0 = 1; // ????? ???? D ????? ????? ?????

TRISC = 0; // ????? ???? C ?????

PORTC = 0; // ????? ????? ???? C

Lcd_Init(); // ????? ???? ?? LCD

Lcd_Cmd(_LCD_CURSOR_OFF); // ????? ??????

Lcd_Out(1, 1, "Time:"); // ??? "Time:" ??? ???? ?? LCD

while (1) {

if (PORTD.B0 == 1) { // ??? ??? ??????? ???????

PORTC.B0 = 1; // ????? ?? LED

Delay_ms(1000); // ????? ???? 1 ?????


time_count++; // ????? ?????? ?????

IntToStr(time_count, txt); // ????? ????? ??? ??

Ltrim(txt); // ????? ??????? ??????? ?? ??????

Lcd_Out(2, 1, txt); // ??? ?????? ??? ?? LCD

if (time_count == 25) { // ??? ??? ?????? ????? 30

PORTC.B1 = 1; // ????? PORTC.B1

} else { // ??? ??? ??????? ??? ?????

time_count = 0; // ????? ????? ?????? ??? ?????

PORTC.B0 = 0; // ????? ?? LED

PORTC.B1 = 0; // ????? PORTC.B1

Lcd_Cmd(_LCD_CLEAR); // ??? ???? ?? LCD

Lcd_Out(1, 1, "Time:"); // ????? ??? "Time:" ??? ?? LCD

You might also like