Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

problem on count display on lcd in mikroC

Status
Not open for further replies.

bbgil

Full Member level 2
Joined
Mar 11, 2006
Messages
135
Helped
13
Reputation
26
Reaction score
9
Trophy points
1,298
Activity points
2,321
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) ;
}//~!
 

mikroc lcd_out problems

Hi

You missed two "{" in ur porgram

One "void main() {" add a opening "{"

and closing one at the end

Regards
Nandhu
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top