Wednesday, December 26, 2018
T2
#define digit1 PORTB.F5
#define digit2 PORTB.F6
#define digit3 PORTB.F7
unsigned char segment[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
unsigned char i,j;
void interrupt()
{
if(INTCON.INT0IF==1)
{
i++;
if(i>9)i=0;
INTCON.INT0IF=0;
}
if(INTCON3.INT1IF==1)
{
j++;
if(j>9)j=0;
INTCON3.INT1IF=0;
}
}
void main()
{
TRISB=0x03;
TRISC=0;
INTCON.INT0IE=1;
INTCON.INT0IF=0;
INTCON2.INTEDG0=0;
INTCON3.INT1IE=1;
INTCON3.INT1IF=0;
INTCON2.INTEDG1=0;
INTCON.GIE=1;
while(1)
{
digit1=0;digit2=1;digit3=1;
PORTC=segment[i];
delay_ms(25);
digit1=1;digit2=0;digit3=1;
PORTC=~0x3F;
delay_ms(25);
digit1=1;digit2=1;digit3=0;
PORTC=segment[j];
delay_ms(25);
}
}
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