OK.ME
Newbie
MY proteus simulation shows error for pic16f877a for the 7 sement 4 digit led display counter. my code is
#pragma config FOSC = EXTRC // Oscillator Selection bits (RC oscillator)
#pragma config WDTE = ON // Watchdog Timer Enable bit (WDT enabled)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOREN = ON // Brown-out Reset Enable bit (BOR enabled)
#pragma config LVP = ON // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3/PGM pin has PGM function; low-voltage programming enabled)
#pragma config CPD = OFF // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
#pragma config WRT = OFF // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control)
#pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off)
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
#include <xc.h>
#define _XTAL_FREQ 20000000UL // 20MHz
unsigned char hexvalue[10]= {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
void main(void){
int a,b,c,d;
int i, j;
PORTCbits.RC0 = 0; // First Digit Bit Set as output
PORTCbits.RC1 = 0; // Second Digit Bit Ser as output
PORTCbits.RC2 = 0; // Third Digit Bit Set as output
PORTCbits.RC3 = 0; // Fourth Digit Bit Ser as output
PORTD = 0; // DATA pin FOR LCD 8bits port D as output
TRISD = 0; // Direction for Port D
TRISCbits.TRISC0= 0;//Set First bit direction
TRISCbits.TRISC1 = 0; // Set Second bit Direction
TRISCbits.TRISC2 = 0;//Set Third bit direction
TRISCbits.TRISC3 = 0; // Set Fourth bit Direction
while(1)
{
for (i=0;i<=9999;i++)
{
a = i/1000; // holds 1000's digit
b = ((i/100)%10); // holds 100's digit
c = ((i/10)%10); // holds 10th digit
d = (i%10); // holds unit digit value
for (j = 0; j< 10; j++){
PORTD=hexvalue[a]; // send 1000's place data to fourth digit
PORTCbits.RC0=0; // turn on forth display unit
__delay_ms(1);
PORTCbits.RC0=1; // turn off forth display unit
PORTD=hexvalue; // send 100's place data to 3rd digit
PORTCbits.RC1=0; // turn on 3rd display unit
__delay_ms(1);
PORTCbits.RC1=1; // turn off 3rd display unit
PORTD=hexvalue[c]; // send 10th place data to 2nd digit
PORTCbits.RC2 = 0; // turn on 2nd display unit
__delay_ms(1);
PORTCbits.RC2 = 1; // turn off 2nd display unit
PORTD=hexvalue[d]; // send unit place data to 1st digit
PORTCbits.RC3 = 0; // turn on 1st display unit
__delay_ms(1);
PORTCbits.RC3 = 1; // turn off 1st display unit
}}
}}
there is no any compilation error in mplab but in proteus segment display is shwing as expected and there is error showing "eeprom data has invalid address[2000]".
please help anyone i need to submit my clg project by tmrw.
#pragma config FOSC = EXTRC // Oscillator Selection bits (RC oscillator)
#pragma config WDTE = ON // Watchdog Timer Enable bit (WDT enabled)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOREN = ON // Brown-out Reset Enable bit (BOR enabled)
#pragma config LVP = ON // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3/PGM pin has PGM function; low-voltage programming enabled)
#pragma config CPD = OFF // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
#pragma config WRT = OFF // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control)
#pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off)
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
#include <xc.h>
#define _XTAL_FREQ 20000000UL // 20MHz
unsigned char hexvalue[10]= {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
void main(void){
int a,b,c,d;
int i, j;
PORTCbits.RC0 = 0; // First Digit Bit Set as output
PORTCbits.RC1 = 0; // Second Digit Bit Ser as output
PORTCbits.RC2 = 0; // Third Digit Bit Set as output
PORTCbits.RC3 = 0; // Fourth Digit Bit Ser as output
PORTD = 0; // DATA pin FOR LCD 8bits port D as output
TRISD = 0; // Direction for Port D
TRISCbits.TRISC0= 0;//Set First bit direction
TRISCbits.TRISC1 = 0; // Set Second bit Direction
TRISCbits.TRISC2 = 0;//Set Third bit direction
TRISCbits.TRISC3 = 0; // Set Fourth bit Direction
while(1)
{
for (i=0;i<=9999;i++)
{
a = i/1000; // holds 1000's digit
b = ((i/100)%10); // holds 100's digit
c = ((i/10)%10); // holds 10th digit
d = (i%10); // holds unit digit value
for (j = 0; j< 10; j++){
PORTD=hexvalue[a]; // send 1000's place data to fourth digit
PORTCbits.RC0=0; // turn on forth display unit
__delay_ms(1);
PORTCbits.RC0=1; // turn off forth display unit
PORTD=hexvalue; // send 100's place data to 3rd digit
PORTCbits.RC1=0; // turn on 3rd display unit
__delay_ms(1);
PORTCbits.RC1=1; // turn off 3rd display unit
PORTD=hexvalue[c]; // send 10th place data to 2nd digit
PORTCbits.RC2 = 0; // turn on 2nd display unit
__delay_ms(1);
PORTCbits.RC2 = 1; // turn off 2nd display unit
PORTD=hexvalue[d]; // send unit place data to 1st digit
PORTCbits.RC3 = 0; // turn on 1st display unit
__delay_ms(1);
PORTCbits.RC3 = 1; // turn off 1st display unit
}}
}}
there is no any compilation error in mplab but in proteus segment display is shwing as expected and there is error showing "eeprom data has invalid address[2000]".
please help anyone i need to submit my clg project by tmrw.