bbgil
Full Member level 2

mikroc other char set for lcd ?
hi guys. i'm trying to make a simple count up display approximatel every sec on an lcd. It showing the character : but thats it. its not incrementing or doing anything else. I'm using PIC16f877a and lcd in 4-bit mode. any help would be appreciated.
Here is the code in mikroC.
unsigned short ch;
unsigned int t, cnt;
char a[17], *tc;
unsigned short sec;
long tlong;
void seconds;
void interrupt() {
cnt++; // Increment value of cnt on every interrupt
if (cnt==400)
for (sec=0 ; sec<=9u; sec++) {
ch= (sec);
Delay_ms (500);
cnt =0;
}
TMR0 = 96;
INTCON = 0x20; // Set T0IE, clear T0IF
}//~
void main() {
OPTION_REG = 0x84; // Assign prescaler to TMR0
TRISB = 0; // PORTB is output
PORTB = 0xFF; // Initialize PORTB
TMR0 = 96;
INTCON = 0xA0; // Enable TMRO interrupt
LCD_Init(&PORTB); // initialize (4-bit interface connection)
LCD_Cmd(LCD_CURSOR_OFF); // send command to LCD (cursor off)
LCD_Cmd(LCD_CLEAR); // send command to LCD (clear LCD)
tc = "Count is now:"; // assign text to string a
LCD_Out(1,1,tc); // print string a on LCD, 1st row, 1st column
TRISC = 0;
TRISD = 0;
Delay_ms(1000);
tc = "AM"; // assign text to string a
cnt=0;
do {
LCD_Out(2,13,tc);
ch=sec;
LCD_Chr(2,9, 48+ch);
Delay_ms (200);
} while (1) ;
}//~!
hi guys. i'm trying to make a simple count up display approximatel every sec on an lcd. It showing the character : but thats it. its not incrementing or doing anything else. I'm using PIC16f877a and lcd in 4-bit mode. any help would be appreciated.
Here is the code in mikroC.
unsigned short ch;
unsigned int t, cnt;
char a[17], *tc;
unsigned short sec;
long tlong;
void seconds;
void interrupt() {
cnt++; // Increment value of cnt on every interrupt
if (cnt==400)
for (sec=0 ; sec<=9u; sec++) {
ch= (sec);
Delay_ms (500);
cnt =0;
}
TMR0 = 96;
INTCON = 0x20; // Set T0IE, clear T0IF
}//~
void main() {
OPTION_REG = 0x84; // Assign prescaler to TMR0
TRISB = 0; // PORTB is output
PORTB = 0xFF; // Initialize PORTB
TMR0 = 96;
INTCON = 0xA0; // Enable TMRO interrupt
LCD_Init(&PORTB); // initialize (4-bit interface connection)
LCD_Cmd(LCD_CURSOR_OFF); // send command to LCD (cursor off)
LCD_Cmd(LCD_CLEAR); // send command to LCD (clear LCD)
tc = "Count is now:"; // assign text to string a
LCD_Out(1,1,tc); // print string a on LCD, 1st row, 1st column
TRISC = 0;
TRISD = 0;
Delay_ms(1000);
tc = "AM"; // assign text to string a
cnt=0;
do {
LCD_Out(2,13,tc);
ch=sec;
LCD_Chr(2,9, 48+ch);
Delay_ms (200);
} while (1) ;
}//~!