Professional Documents
Culture Documents
Common Cathode: In this type of segments all the cathode terminals are
made common and tied to GND. Thus, the segments a to g needs a logic
High signal(5v) in order to glow.
Common Anode: In this type of segments all the anodes terminals are
made common and tied to VCC(5v). Thus, the segments a to g needs a
logic LOW signal (GND) in order to glow.
CODE:
#include<htc.h>
#define _XTAL_FREQ 8000000
void main()
{
TRISB=0X00;
PORTB=0X00;
while(1)
{
PORTB=0X3F;
__delay_ms(100);
PORTB=0X06;
__delay_ms(100);
PORTB=0X5B;
__delay_ms(100);
PORTB=0X4F;
__delay_ms(100);
PORTB=0X66;
__delay_ms(100);
PORTB=0X6D;
__delay_ms(100);
PORTB=0X7D;
__delay_ms(100);
PORTB=0X07;
__delay_ms(100);
PORTB=0X7F;
__delay_ms(100);
PORTB=0X6F;
__delay_ms(100);
}
}
OUTPUT: