Wednesday, December 26, 2018
T7
void main()
{
unsigned char clock[4];
unsigned char sec;
TRISC=0;
Lcd_Init(&PORTC);
Lcd_Cmd(LCD_CURSOR_OFF);
Lcd_Cmd(LCD_CLEAR);
T0CON=0x05;
TMR0H=0xC2;
TMR0L=0xF7;
INTCON.TMR0IF=0;
T0CON.TMR0ON=1;
while(1)
{
Lcd_Chr(1,6,clock[0]+48);
Lcd_Chr(1,7,clock[1]+48);
Lcd_Chr(1,8,':');
Lcd_Chr(1,9,clock[2]+48);
Lcd_Chr(1,10,clock[3]+48);
while(!INTCON.TMR0IF);
T0CON.TMR0ON=0;
sec++;
if(sec>59)
{
sec=0;
clock[3]++;
}
if(clock[3]>9)
{
clock[3]=0;
clock[2]++;
}
if(clock[2]>5)
{
clock[2]=0;
clock[1]++;
}
if(clock[1]>9)
{
clock[1]=0;
clock[0]++;
}
if(clock[0]==2&&clock[1]>3)
{
clock[0]=0;
clock[1]=0;
}
TMR0H=0xC2;
TMR0L=0xF7;
INTCON.TMR0IF=0;
T0CON.TMR0ON=1;
Lcd_Cmd(LCD_CLEAR);
}
}
Subscribe to:
Post Comments (Atom)
สรุปงานที่ 5 Internet of Things (IoT)
Internet of Things (IoT) คืออะไร Internet of Things (IoT) คือ "อินเตอร์เน็ตในทุกสิ่ง" หมายถึง การที่อุปกรณ์ต่างๆ ส...
-
Digital Speedometer and Odometer Circuit using PIC Microcontroller EMBEDDED By Aswinth Raj Jul 27, 2017 24 Digital Speedometer and...
-
How to Save Data using EEPROM in PIC16F877A Microcontroller By Aswinth Raj Aug 10, 2017 2 Saving Data using...
-
Generating PWM using PIC Microcontroller with MPLAB and XC8 EMBEDDED By Aswinth Raj Mar 15, 2017 35 Generating PWM using PIC Micr...
No comments:
Post a Comment