hi guys i'm trying to code in MikroC using C language, can somebody help me with my code or provide me a very simple code. I want that after every second the ':' will be on and off its not yet 1 second also after every second the buzzer will play and a number will decrement by 1 lets say 60 cause im making a clock in LCD.
here is my code and stock in blingkin : cant follow up with the number. after one second the buzzer turns on i think but the ':' comes with cursor on in the first row of the LCD please help me i'm new with the interrupts, i assume that interrupts starts after you declare the value of TMR0, tnx
// LCD module connections
sbit LCD_RS at RA0_bit;
sbit LCD_EN at RA1_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_RS_Direction at TRISA0_bit;
sbit LCD_EN_Direction at TRISA1_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections
char Blink2[]=":";
unsigned short i,j,Num,Blink;
void Debounce(){
delay_ms(500);}
void Play(){
Sound_Play(2500, 500);}
void interrupt() {
Num++;
if(Num==18){
j=1;
Play();
Num=0;
}
TMR0=39;
INTCON.T0IF=0;
}
void main(){
CMCON=0x07;
TRISA=0b00100100;
TRISB=0b00000000;
Sound_Init(&PORTB,4);
Num=0;
i=0;
j=0;
OPTION_REG=0x07;
TMR0=39;
INTCON=0xA0;
INTCON.T0IF=0;
do{
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
if(j==1){
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(2,8,Blink2);}
while(i<2){
Debounce();
i++;}
}while(1);
}
here is my code and stock in blingkin : cant follow up with the number. after one second the buzzer turns on i think but the ':' comes with cursor on in the first row of the LCD please help me i'm new with the interrupts, i assume that interrupts starts after you declare the value of TMR0, tnx
// LCD module connections
sbit LCD_RS at RA0_bit;
sbit LCD_EN at RA1_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_RS_Direction at TRISA0_bit;
sbit LCD_EN_Direction at TRISA1_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections
char Blink2[]=":";
unsigned short i,j,Num,Blink;
void Debounce(){
delay_ms(500);}
void Play(){
Sound_Play(2500, 500);}
void interrupt() {
Num++;
if(Num==18){
j=1;
Play();
Num=0;
}
TMR0=39;
INTCON.T0IF=0;
}
void main(){
CMCON=0x07;
TRISA=0b00100100;
TRISB=0b00000000;
Sound_Init(&PORTB,4);
Num=0;
i=0;
j=0;
OPTION_REG=0x07;
TMR0=39;
INTCON=0xA0;
INTCON.T0IF=0;
do{
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
if(j==1){
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(2,8,Blink2);}
while(i<2){
Debounce();
i++;}
}while(1);
}