Hello everyone.
I am doing just a simple project to connect a 3 digit LED display to a PIC16F690 using the PICKIT 2 development board from Microchip.
The program just counts up every second. I would first like to stick with the first digit, and when I get to ten jump to the second digit etc.
I program the chip and on the 3 digit display it counts up, but all digits count instead of just one. I have all three digit pins grounded. I have tried to "shut off" the pins in the program but still to no avail.
By the way, it is a common cathode display. It is made by Fairchild MST4141C. It is kinda hard to find the datasheet because it looks like Fairchild was bought by Everlight I believe.
Here is the simple program.
Thanks for any help provided.
I am doing just a simple project to connect a 3 digit LED display to a PIC16F690 using the PICKIT 2 development board from Microchip.
The program just counts up every second. I would first like to stick with the first digit, and when I get to ten jump to the second digit etc.
I program the chip and on the 3 digit display it counts up, but all digits count instead of just one. I have all three digit pins grounded. I have tried to "shut off" the pins in the program but still to no avail.
By the way, it is a common cathode display. It is made by Fairchild MST4141C. It is kinda hard to find the datasheet because it looks like Fairchild was bought by Everlight I believe.
Here is the simple program.
Rich (BB code):
#include <htc.h>
int ones = 0b00010000;
int tens = 0b00100000;
int hundreds = 0b01000000;
int zero = 0b00000000;
int one = 0b00000110;
int two = 0b01011011;
int three = 0b01001111;
int four = 0b01100110;
int five = 0b01101101;
int six = 0b01111100;
int seven = 0b00000111;
int eight = 0b01111111;
int nine = 0b01100111;
__CONFIG (INTIO & WDTDIS & MCLRDIS & UNPROTECT);
void pause (unsigned short usvalue);
main ()
{
unsigned char state_led = 0;
ANSEL = 0;
ANSELH = 0;
CM1CON0 = 0;
CM2CON0 = 0;
PORTB = 0xFF;
PORTC = 0x00;
TRISB = 0x00;
TRISC = 0x00;
while (1==1)
{
state_led++;
switch (state_led)
{
case 1:
PORTC = ones;
PORTB = one;
break;
case 2:
PORTC = ones;
PORTB = two;
break;
case 3:
PORTB = ones;
PORTC = three;
break;
case 4:
PORTB = ones;
PORTC = four;
break;
case 5:
PORTB = ones;
PORTC = five;
break;
case 6:
PORTB = ones;
PORTC = six;
break;
case 7:
PORTB = ones;
PORTC = seven;
break;
case 8:
PORTB = ones;
PORTC = eight;
break;
case 9:
PORTB = ones;
PORTC = nine;
break;
default:
state_led = 0;
PORTC = zero;
break;
}
pause(1000);
}
}