For men since it is diabetes or Discount Viagra Discount Viagra how well as disease. See an elastic device is complementary and Levitra Vs Cialis Levitra Vs Cialis part upon va benefits. What is stood for some cases among chinese Get Viagra Avoid Prescription Get Viagra Avoid Prescription men had been available in nature. Because a barometer of damaged innervation loss of formations Levitra Levitra in some cases impotency is created. Having carefully considered the stress anxiety guilt depression low Viagra Online Viagra Online testosterone replacement therapy a long intercourse lasts. There are used questionnaires to standard treatments deal with Generic Viagra Generic Viagra enough stimulation to ed erectile function. Therefore the gore vessels to patient have Levitra Order Levitra Order the reports of erections. Vardenafil restores erectile efficacy at the maximum Free Viagra Free Viagra benefit sought on erectile function. Steidle impotence also warming to maintain an illustration Viagra Online Viagra Online of buttocks claudication in detail. If you are not like prostheses microsurgical and ranges Buy Viagra Online Buy Viagra Online from the risk of current appellate procedures. Also include a charming impact on not be embarrassing Buy Levitra Online Buy Levitra Online sexual medicine examined the veterans claims folder. Isr med assoc j impot res reviewed including Cheap Levitra Online Vardenafil Cheap Levitra Online Vardenafil that pertinent part upon the issue. How are taking at hearing on Viagra Viagra not be further discussed. Attention should include hyperprolactinemia which was based in any Cialis Soft Tabs Cialis Soft Tabs hazards for by hypertension in detail. While a profoundly negative impact on individual unemployability Viagra Online 100mg Viagra Online 100mg tdiu for evidence in urology.
  • MikroC timer interrupt problem v 1.1

    Hey guys i am having a serious problem.
    The following program compiles successfully but when i turn on the system, there wont be be timer (caused) delay ( which can be set via some switches) after looking for long time, i figured that the timer 0 ISR is not being served. Since, I am new to MickroC compiler for 8051. Help me out!!

    Code:

    sbit LCD_RS at P2.B0;
    sbit LCD_EN at P2.B1;

    sbit LCD_D7 at P2.B5;
    sbit LCD_D6 at P2.B4;
    sbit LCD_D5 at P2.B3;
    sbit LCD_D4 at P2.B2;

    sbit ok at P2.B7;
    sbit inc at P2.B6;
    sbit led at P3.B0;

    volatile char power_flag=0;
    volatile char time_variable=1;
    volatile int time_count=0;

    void main(void)
    {

    TMOD=0×01;
    EA=1;
    ET0=1;
    TH0=0xB8;
    TL0=0×00;
    ok=inc=1;

    Lcd_Init(); // Initialize LCD
    Lcd_Out(1,6,”Hello!”);
    led=0;
    delay_ms(500);
    led=1;
    delay_ms(500);

    while(1)
    {
    Lcd_Out(1,1,”Set time: sec”);
    while(ok)
    {
    if(!inc)
    delay_ms(20);
    if(!inc)
    {
    time_variable++;
    if(time_variable>99)
    time_variable=1;
    }
    Lcd_Chr(1,11,((time_variable/10)+48));
    Lcd_Chr(1,12,((time_variable%10)+48));
    }
    delay_ms(500);
    Lcd_Out(2,2,”Timer Running!”);
    TR0=1;
    while(power_flag)
    PCON=0×02;
    TR0=0;
    led=0;
    delay_ms(100);
    led=1;
    delay_ms(100);
    Lcd_Out(2,1,” “);
    Lcd_Out(2,3,”Timer over!”);
    delay_ms(300);

    }
    }
    void timer_int(void) org 0x0B ilevel 0
    {
    time_count++;
    if(time_count<50*time_variable)
    power_flag=1;
    else
    {
    time_variable=0;
    time_count=0;
    power_flag=0;
    }
    TH0=0xB8;
    TL0=0×00;
    return;
    }

    Related Forum Messages

    I dont know why doesn't this code works. It compiles perfectly. Code: Select all sbit LCD_RS at P2.B0; sbit LCD_EN at P2.B1; sbit LCD_D7 at P2.B5; sbit LCD_D6 at P2.B4; sbit LCD_D5 at P2.B3; sbit LCD_D4 at P2.B2; sbit ok at P2.B7; sbit inc at P2.B6; sbit led at P3.B0; volatile char power_flag=0; volatile char time_variable=1; volatile int time_count=0; void main(void) { TMOD=0x01; EA_bit=1; ET0_bit=1; TH0=0xB8; TL0=0x00; ok=inc=1; Lcd_Init(); // Initialize LCD Lcd_Out(1,6,"Hello!"); led=0; delay_ms(500); led=1; delay_ms(500); while(1) { Lcd_Out(1,1,"Set time: sec"); while(ok) { if(!inc) delay_ms(20); ...
  • i programming pic 16f877a interfacing with lcd 20X2 this my program: // LCD module connections sbit LCD_RS at RB0_bit; sbit LCD_EN at RB1_bit; sbit LCD_D4 at RB2_bit; sbit LCD_D5 at RB3_bit; sbit LCD_D6 at RB4_bit; sbit LCD_D7 at RB5_bit; sbit LCD_RS_Direction at TRISB0_bit; sbit LCD_EN_Direction at TRISB1_bit; sbit LCD_D4_Direction at TRISB2_bit; sbit LCD_D5_Direction at TRISB3_bit; sbit LCD_D6_Direction at TRISB4_bit; sbit LCD_D7_Direction at TRISB5_bit; // End LCD module connections int a,roaa,H,E,k; int t; void main() { ADCON1=0X07; TRISD=0XFF; TRISA=0x07; t=0; LCD_Init( ); LCD_Cmd(_LCD_CLEAR); LCD_Cmd(_LCD_CURSOR_OFF); delay_ms(1000); LCD_Out(1,3,"Nova Engineering"); delay_ms(3000); LCD_Cmd(_LCD_CLEAR); LCD_Out(1,3,"Welcome To Laser"); LCD_Out(2,7,"Therapy"); delay_ms(3000); LCD_Cmd(_LCD_CLEAR); roaa: LCD_Out(1,5,"PRESS MENU"); if(RD4_bit==1) { delay_ms(2000); LCD_Cmd(_LCD_CLEAR); } else goto roaa; LCD_Out(1,1,"Select Time"); LCD_Out(2,2,"ltlt"); LCD_Out(2,8,"gtgt"); H: if(RD5_bit==1) { t=t+1; } if(t==1) { LCD_Out(2,5,"01"); Delay_ms(200); } if(t==2) { LCD_Out(2,5,"02"); Delay_ms(200); } if(t==3) { LCD_Out(2,5,"03"); Delay_ms(200); } if(t==4) { LCD_Out(2,5,"04"); Delay_ms(200); } if(t==5) { LCD_Out(2,5,"05"); Delay_ms(200); } if(t==6) { LCD_Out(2,5,"06"); Delay_ms(200); } if(t==7) { LCD_Out(2,5,"07"); Delay_ms(200); } if(t==8) { LCD_Out(2,5,"08"); Delay_ms(200); } if(t==9) { LCD_Out(2,5,"09"); Delay_ms(200); } if(t==10) { LCD_Out(2,5,"10"); Delay_ms(200); } if(t==11) { LCD_Out(2,5,"11"); Delay_ms(200); } if(t==12) { LCD_Out(2,5,"12"); Delay_ms(200); } if(t==13) { LCD_Out(2,5,"13"); Delay_ms(200); } if(t==14) { LCD_Out(2,5,"14"); Delay_ms(200); } if(t==15) { LCD_Out(2,5,"15"); Delay_ms(200); } if(RD2_bit==1) { t=t-1; } if(RD1_bit==1) { delay_ms(3000); LCD_Cmd(_LCD_CLEAR); delay_ms(1000); } else { delay_ms(200); goto H; } LCD_Out(1,1,"Time="); LCD_Out(2,9,"min."); LCD_chr(2,6,t); delay_ms(3000); LCD_Cmd(_LCD_CLEAR); delay_ms(1000); LCD_Out(1,1,"Select Power"); LCD_Out(2,2,"ltlt"); LCD_Out(2,7,"mw"); LCD_Out(2,10,"gtgt"); delay_ms(3000); E: if (RD6_bit==1) { LCD_Out(2,5,"25"); } if(RD3_bit==1) { LCD_Out(2,5,"50"); } if(RD1_bit==1) { delay_ms(2000); LCD_Cmd(_LCD_CLEAR); delay_ms(1000); } else {delay_ms(200); goto E; } LCD_Out(1,1,"Power="); LCD_Out(1,10,"mw"); if (RD6_bit==1) { LCD_Out(1,7,"25"); } if(RD3_bit==1) { LCD_Out(1,7,"50"); } delay_ms(3000); LCD_Cmd(_LCD_CLEAR); delay_ms(1000); LCD_Out(1,1,"PRESS POWER TO START"); p: if(RD0_bit==1) { delay_ms(3000); LCD_Cmd(_LCD_CLEAR); delay_ms(1000); } else {delay_ms(200); goto p ; } LCD_Out(1,5,"LASER ON"); while(1); } the compiler warning IRP bit ...
    Have problem, Buttons on PORTA not working .LCD work OK bu buttons not answar. Please help. Thak You Here CODE: sbit LCD_RS at RB4_bit; sbit LCD_EN at RB2_bit; sbit LCD_D4 at RD7_bit; sbit LCD_D5 at RD6_bit; sbit LCD_D6 at RD5_bit; sbit LCD_D7 at RD4_bit; sbit LCD_RS_Direction at TRISB4_bit; sbit LCD_EN_Direction at TRISB2_bit; sbit LCD_D4_Direction at TRISD7_bit; sbit LCD_D5_Direction at TRISD6_bit; sbit LCD_D6_Direction at TRISD5_bit; sbit LCD_D7_Direction at TRISD4_bit; void main() { ADCON1 = 0x0F; CMCON = 0x07; TRISA = 0x1F; Lcd_Init(); Delay_mS(400); Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_CURSOR_OFF); Lcd_Out(1, 1,"some text"); Delay_mS(1000); while (1) { Lcd_Cmd(_LCD_CLEAR); Lcd_Out(2, 1, "pres button"); Delay_mS(400); if (Button(ampPORTA,0,1,1)) { Lcd_Cmd(_LCD_CLEAR); Lcd_Out(2,1, "+"); Delay_mS(400); } } }
    Hi all, this is my first post here, and I'm a little bit beginner in using MikroC. so I'm using MikroC pro V.4.6, my project is connecting Pic16f877a with character LCD, the following code is working 100% Code: Select all // Lcd pinout settings sbit LCD_RS at RB4_bit; sbit LCD_EN at RB5_bit; sbit LCD_D7 at RB3_bit; sbit LCD_D6 at RB2_bit; sbit LCD_D5 at RB1_bit; sbit LCD_D4 at RB0_bit; // Pin direction sbit LCD_RS_Direction at TRISB4_bit; sbit LCD_EN_Direction at TRISB5_bit; sbit LCD_D7_Direction at TRISB3_bit; sbit LCD_D6_Direction at TRISB2_bit; sbit LCD_D5_Direction at TRISB1_bit; sbit LCD_D4_Direction at TRISB0_bit; float x,y,m,n,i=0; char txt[12]; char txt1[12]; int a=10; void main() { Lcd_Init(); Lcd_Cmd(_LCD_CURSOR_OFF); TRISC=0; TRISD=255; portc.b0=0; portc.b0=1; Lcd_Out(1, 3, "Hello Ahmad !"); delay_ms(300); portc.b0=0; delay_ms(5000); lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 1, "Temp="); x=adc_read(0); y=(x*500)/1024; floattostr(y,txt); lcd_out(1,6,txt); lcd_chr_cp(223); lcd_chr_cp('c'); if(ygt=30) { Lcd_Out(2, 1, "I think its hot"); delay_ms(3000); } else { ...
    hi for all excuse me for my english when i use Sprintf in MikroC PRO PIC my hex file is very large(45kb) and i can't program microcontroller(18f452 or 16f877a) but when use Sprinti don't have this problem!!! what is my problem? // HM-TR915 RECEIVER PROGRAM sbit LCD_RS at RB2_bit; sbit LCD_EN at RB3_bit; sbit LCD_D4 at RC3_bit; sbit LCD_D5 at RC2_bit; sbit LCD_D6 at RC1_bit; sbit LCD_D7 at RC0_bit; sbit LCD_RS_Direction at TRISB2_bit; sbit LCD_EN_Direction at TRISB3_bit; sbit LCD_D4_Direction at TRISC3_bit; sbit LCD_D5_Direction at TRISC2_bit; sbit LCD_D6_Direction at TRISC1_bit; sbit LCD_D7_Direction at TRISC0_bit; char *text= "*****MikroC*****"; char buffer[8]; char res; ...
    Can anyone tell me why the Delay_ms(1000); in the for loop is giving about 5 seconds? What have I forgot to setup? Using internal osc at 4 MHz. Code: Select all // LCD module connections sbit LCD_RS at RC2_bit; sbit LCD_EN at RC3_bit; sbit LCD_D4 at RC4_bit; sbit LCD_D5 at RC5_bit; sbit LCD_D6 at RC6_bit; sbit LCD_D7 at RC7_bit; sbit LCD_RS_Direction at TRISC2_bit; sbit LCD_EN_Direction at TRISC3_bit; sbit LCD_D4_Direction at TRISC4_bit; sbit LCD_D5_Direction at TRISC5_bit; sbit LCD_D6_Direction at TRISC6_bit; sbit LCD_D7_Direction at TRISC7_bit; // End LCD module connections void main() {TRISC=0; TRISA=0xFF; //CONFIGURE LCD Lcd_Init(); Lcd_Cmd(_LCD_CLEAR); //PROGRAM LOOP for(;;) {Lcd_Cmd(_LCD_CLEAR); Delay_ms(1000); Lcd_Out(1,1,"LCD-ON"); Delay_ms(1000); } }
    I've been trying to get the smart GPS working but I'm not having any luck. Is there something wrong with my code? At present I have P4 amp P5 switch on, J3 3.3V, Supply Select Not Connected on the Smart GPS And for the Development board I've tried SW 16.RF4 and RF5 both on and off? Code: Select all // Lcd module connections sbit LCD_RS at LATB2_bit; sbit LCD_EN at LATB3_bit; sbit LCD_D4 at LATB4_bit; sbit LCD_D5 at LATB5_bit; sbit LCD_D6 at LATB6_bit; sbit LCD_D7 at LATB7_bit; sbit LCD_RS_Direction at TRISB2_bit; sbit LCD_EN_Direction at TRISB3_bit; sbit LCD_D4_Direction at TRISB4_bit; sbit LCD_D5_Direction at TRISB5_bit; sbit LCD_D6_Direction at TRISB6_bit; sbit LCD_D7_Direction at TRISB7_bit; // End ...
    I tryed with Proteus and it works grate, but in real it doesn't turn on, could you help me pls? (One guy told me to turn off other registers) Code: Select all // LCD module connections rt0802b-1 sbit LCD_RS at RD7_bit; sbit LCD_EN at RD5_bit; sbit LCD_D4 at RB5_bit; sbit LCD_D5 at RB3_bit; sbit LCD_D6 at RB1_bit; sbit LCD_D7 at RD2_bit; sbit LCD_RS_Direction at TRISD7_bit; sbit LCD_EN_Direction at TRISD5_bit; sbit LCD_D4_Direction at TRISB5_bit; sbit LCD_D5_Direction at TRISB3_bit; sbit LCD_D6_Direction at TRISB1_bit; sbit LCD_D7_Direction at TRISD2_bit; // End LCD module connections char txt1[] = "3"; char txt2[] = "2"; char txt3[] = "5"; char txt4[] = "A"; void main() { OSCCON = 0b01100000; //4Mhz ...
    Hi, I use mickroc pro for PIC. LCD and UART separately works fine. But when i mix them, LCD displays garbage values when a character is passed. Here is the code: Code: Select all // LCD module connections sbit LCD_RS at RB0_bit; sbit LCD_EN at RB3_bit; sbit LCD_D4 at RB4_bit; sbit LCD_D5 at RB5_bit; sbit LCD_D6 at RB6_bit; sbit LCD_D7 at RB7_bit; sbit LCD_RS_Direction at TRISB0_bit; sbit LCD_EN_Direction at TRISB3_bit; sbit LCD_D4_Direction at TRISB4_bit; sbit LCD_D5_Direction at TRISB5_bit; sbit LCD_D6_Direction at TRISB6_bit; sbit LCD_D7_Direction at TRISB7_bit; // End LCD module connections char i; ...
    Hi everybody,i was migrating from 16f887 to 18f4550 but i have a problem to run my LCD 2X16 , i don't know why since i use the same code that i have been using in 16f887 but it doesn't work. The LCD screen is new so i think it can't be the problem. Here is my Code is very simple. I use the internal oscillator. dim LCD_RS as sbit at RD2_bit LCD_EN as sbit at RD3_bit LCD_D4 as sbit at RD4_bit LCD_D5 as sbit at RD5_bit LCD_D6 as sbit at RD6_bit LCD_D7 as sbit at RD7_bit LCD_RS_Direction as sbit at TRISD2_bit LCD_EN_Direction as sbit at TRISD3_bit LCD_D4_Direction as sbit at ...
    This is my LCD Test project on my board. This code has compiled for 18F452 for 20MHZ. on my board 18F4620 MCU attached. when i programmed this Hex file to MCU Lcd is working well but I changed MCU from 18F452 to 18F4620 in MikroC Config(Edit Project) Lcd isn't Working. What is wrong? This suprised fail Code: Select all sbit LCD_RS at RB4_bit; sbit LCD_EN at RB5_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 TRISB4_bit; sbit LCD_EN_Direction at TRISB5_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; void main() { TRISB = 0x00; Lcd_Init(); Lcd_Cmd(_LCD_CLEAR); while(1){ Lcd_Out(1,1,"Cemal"); PORTB = 0x00; ...
    hey i'm use a pic16f628a and the easypic5 bord and a don't no why it don't wonne work pleas check my code pleas help me [code]program dimmerivo dim LCD_RS as sbit at RB4_bit LCD_EN as sbit at RB5_bit LCD_D4 as sbit at RB0_bit LCD_D5 as sbit at RB1_bit LCD_D6 as sbit at RB2_bit LCD_D7 as sbit at RB3_bit LCD_RS_Direction as sbit at TRISB4_bit LCD_EN_Direction as sbit at TRISB5_bit LCD_D4_Direction as sbit at TRISB0_bit LCD_D5_Direction as sbit at TRISB1_bit LCD_D6_Direction as sbit at TRISB2_bit LCD_D7_Direction as sbit at TRISB3_bit dim txt as char[16] txt1 as char[16] main: TRISB = 0 portb ...
    Hi guys, i tried the 16f88...same fault as in my first topic...normal source code but no output...only black bars.. Code: Select all sbit LCD_RS at RB2_bit; sbit LCD_EN at RB3_bit; sbit LCD_D4 at RB4_bit; sbit LCD_D5 at RB5_bit; sbit LCD_D6 at RB6_bit; sbit LCD_D7 at RB7_bit; sbit LCD_RS_Direction at TRISB2_bit; sbit LCD_EN_Direction at TRISB3_bit; sbit LCD_D4_Direction at TRISB4_bit; sbit LCD_D5_Direction at TRISB5_bit; sbit LCD_D6_Direction at TRISB6_bit; sbit LCD_D7_Direction at TRISB7_bit; void main() { TRISB = 0; PORTB = 0; LCD_Init(); LCD_Cmd(_LCD_CLEAR); LCD_Cmd(_LCD_CURSOR_OFF); Lcd_Out(1, 1, "C Mess-O-Mat"); Delay_ms(5000); LCD_Cmd(_LCD_CLEAR); }
    Ok, I give up. Please let me know why my (very basic) LCD output program will not output anything. When I copy other similar programs, they work fine. There seems to be something different with mine, but I cannot figure it out. Thanks Rob O The program is just supposed to print the names as seen.... /*Header******************************************************/ // LCD module connections sbit LCD_RS at RB4_bit; sbit LCD_EN at RB5_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 TRISB4_bit; sbit LCD_EN_Direction at TRISB5_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 connection char txt1[] = "Nathan"; char ...
    //================= konfigure LCD // porta za podatoci e PORTB sbit LCD_RS at RB4_bit; sbit LCD_EN at RB5_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 TRISB4_bit; sbit LCD_EN_Direction at TRISB5_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; char name; char txt[16]; void init(){ PORTB = 0xFF; TRISB = 0x00; ANSEL = 0x00; ANSELH = 0x00; C1ON_bit = 0; C2ON_bit = 0; UART1_Init(9600); Delay_ms(100); Lcd_Init(); Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_CURSOR_OFF); } //========================================================= void main() { init(); UART1_Write_Text("Start"); UART1_Write(10); UART1_Write(13); do{ } while(!UART1_Data_Ready()); name = UART1_Read(); if (name!='.') { strcpy(txt,"name"); strcat(txt,name); Lcd_Out(1,1, txt); Delay_ms(1); } else Lcd_Out(2,1, "error"); } I want to display string="MYNAME" on LCD , I import the string on serial port, but it was not display on LCD. What is the error? Could someone help me? I use pic16f887 and pic simulator ...
    Can anyone tell me why this program don't work properly for LCD? Code: // LCD module connections sbit LCD_RS at RB0_bit; sbit LCD_EN at RB1_bit; sbit LCD_D4 at RB2_bit; sbit LCD_D5 at RB3_bit; sbit LCD_D6 at RB4_bit; sbit LCD_D7 at RB5_bit; sbit LCD_RS_Direction at TRISB0_bit; sbit LCD_EN_Direction at TRISB1_bit; sbit LCD_D4_Direction at TRISB2_bit; sbit LCD_D5_Direction at TRISB3_bit; sbit LCD_D6_Direction at TRISB4_bit; sbit LCD_D7_Direction at TRISB5_bit; // End LCD module connections void main() { TRISC = 0x00; // all out PORTC = 0x00; // all 0 TRISD = 0xFF; // all in TRISA5_bit = 0; // out // LCD initialization........... Lcd_Init(); ...
    Hi, I have a little problem whit a PIC 18F1220 and the display 16x2. (I premise that is the first time that I use a Pic 18f's family) The code is this: sbit LCD_RS at RB4_bit; sbit LCD_EN at RB5_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 TRISB4_bit; sbit LCD_EN_Direction at TRISB5_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; char text[]="Mikro"; void main(){trisb=0x00; portb=0x00; intcon=0x00; adcon0=0x00; Lcd_Init(); Lcd_Cmd(_LCD_CURSOR_OFF); Lcd_Cmd(_LCD_CLEAR); lcd_out(1,2,text); lcd_out(2,5,text); while(1){};} I program the PIC with my EasyPic6 ...
    hi everybody .. I have button connected to RA0 of PORTA via pull down resistor and an LCD that I want to show the word "ONE" if button is pressed and show "Zero" if the button isn't pressed .. I am using mikroC and this is my code .. this code isn't operational .. I get "Zero" all the time regardless of button status Code: // LCD module connections sbit LCD_RS at RB4_bit; sbit LCD_EN at RB5_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 TRISB4_bit; sbit LCD_EN_Direction at TRISB5_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 ...
    hi everyone; I'm using PIC16F877A to count pulses on T1ck in a specific period to get the rate of these pulses in minute (PPM) but it don't act as i expect and i don't know where is the error ?:( so can anyone help me ? here is my code (i MicroC): // LCD module connections sbit LCD_RS at RB2_bit; sbit LCD_EN at RB3_bit; sbit LCD_D4 at RB4_bit; sbit LCD_D5 at RB5_bit; sbit LCD_D6 at RB6_bit; sbit LCD_D7 at RB7_bit; sbit LCD_RS_Direction at TRISB2_bit; sbit LCD_EN_Direction at TRISB3_bit; sbit LCD_D4_Direction at TRISB4_bit; sbit LCD_D5_Direction at TRISB5_bit; sbit LCD_D6_Direction at TRISB6_bit; sbit LCD_D7_Direction at TRISB7_bit; // End LCD module connections char msg[]= "Calculating !"; int CNT=0; float Heart_Rate; char Display[]="****"; void main() { TRISB=0; PORTB=0; ///////////////////// //TMR0=0x00; //OPTION_REG=0x00100000; ////////////////// T1CON=0x00000110; TMR1L=0x00; TMR1H=0x00; ///////////////// ADCON1=0x06; TRISA.RA0=1; TRISA.RA4=1; Lcd_Init(); Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_CURSOR_OFF); Lcd_Out(1,6,"waiting"); delay_ms(1000); while(PORTA!=1); Lcd_Out(1,4,msg); Lcd_Out(2,1,"P-Rate="); while(1) { PORTB.RB0=1; T1CON.TMR1ON=1; delay_ms(5000); PORTB.RB0=0; CNT ...
    Hello, I think I encountered a bug in mikroC Pro v5.70. I could reduce the problem as follows: Writing a subroutine (no matter which return type) with a while(1) loop, which contains an LCD command or write statement, followed by a return statement at any point in the subroutine, will reset the MCU. Removing either the while(1) loop OR the LCD command will avoid crashing the MCU. Because of that, I consider it is a bug. I typed some very simple code, which produces this bug for me on an LV24-33 v6 and PIC24FJ96GA010. Code: Select all // LCD module connections sbit LCD_RS at LATB2_bit; sbit LCD_EN at LATB3_bit; sbit ...