Wednesday, December 26, 2018
T4
#define digit1 PORTB.F6
#define digit2 PORTB.F7
unsigned char segment[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
int i=6,j=0;
void interrupt()
{
j--;
if(j<0)
{
j=9;
i--;
}
if(i==0&&j==0)
{
T0CON.TMR0ON=0;
PORTB.F5=1;
}
TMR0H=0xC2;
TMR0L=0xF7;
INTCON.TMR0IF=0;
}
void main()
{
TRISB=0x01;
TRISC=0;
PORTB.F5=0;
T0CON=0x05;
TMR0H=0xC2;
TMR0L=0xF7;
INTCON.TMR0IE=1;
INTCON.TMR0IF=0;
INTCON.GIE=1;
while(1)
{
if(PORTB.F0==0)T0CON.TMR0ON=1;
digit1=0;digit2=1;
PORTC=segment[i];
delay_ms(50);
digit1=1;digit2=0;
PORTC=segment[j];
delay_ms(50);
}
}
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