Search Results - MikroC+for

Home Forums Search Search Results for 'MikroC for'

Viewing 15 results - 16 through 30 (of 37 total)
  • Author
    Search Results
  • #11466
    Ligo George
    Keymaster

    Firstly, above code is for MikroC Pro compiler. You can reduce the voltage of Proximity Sensor using Voltage dividing resistors and/or zener diode.

    Continuous pressing of switch is not required, it depends on how you program (how many times you read switch) etc.

    #11341
    Prasad
    Participant

    MikroC compiler gives following message,

    Not enough RAM for call stack __Lib_Delays.c

    how to solve this problem.

    #11251
    Ligo George
    Keymaster

    It is very difficult to obtain accurate variable microsecond delay function. Make the oscillator clock frequency as high as possible and you can use Delay_Cyc() in MikroC which creates delay based in clock cycle. You may also try creating your own delay function like the following (following code is not calibrated for microsecond).

    void Delay(unsigned int i)
    {
        for(;i>0;i--)
        {
        }
    }
    #11234
    Ligo George
    Keymaster

    Micro second variable delays will be very difficult to create and it will not accurate too as each instructions will take a few microsecond to execute. That is why MikroC doesn’t implement this function.

    #11232
    Prasad
    Participant

    How to create “us” variable delay in MikroC

    #11133
    luismk89
    Participant

    I would like to know why are they adding 48.

    // Convert temp_fraction to characters
    text[4] =  temp_fraction/1000    + 48;         // Extract thousands digit
    text[5] = (temp_fraction/100)%10 + 48;         // Extract hundreds digit
    text[6] = (temp_fraction/10)%10  + 48;         // Extract tens digit
    text[7] =  temp_fraction%10      + 48;         // Extract ones digit
    

    Thanks for your help 🙂

    #11112
    Ligo George
    Keymaster

    Using Interrupt with PIC Microcontroller – MikroC

    Please read the datasheet of PIC 16F877A microcontroller… there you can find the procedure to use timer / counter module.

    #10943

    In reply to: PWM by pic 16F877A

    Ligo George
    Keymaster

    MikroC libraries are working fine without any problem. Try the following link.

    Generating PWM with PIC Microcontroller – MikroC

    #10942
    Ligo George
    Keymaster

    If you are using MikroC, please use the HELP section to find details of SoftUART library. It is very easy to use.

    #10940
    Yash
    Participant

    Hey guys,

    I am using 16F877A to output PWM, increasing and decreasing it via two push buttons its based on the code used in DC Motor Speed Control using PWM with PIC Microcontroller in MikroC but the problem is that after a certain PWM value the PWM  will not decrease and I have also added a switch with instantly makes duty value zero but it also doesn’t work after a certain pwm value and I have tried it on Proteus as well as with leds in real life but they give the same result. Only way it goes low is to keep pressing the UP button then some how it come down to a low value then other two switches start working and I then can switch it pwm off. Don’t know whats wrong.

    Here is the code:-

    {
      adc = ADC_Read(1); // Get 10-bit results of AD conversion
      rpm_temp = adc * 2; //converting analog value to rpm
      WordToStr(rpm_temp, speed_out); //converting integer to string to disply on LCD
      Lcd_Out(2,9,speed_out);//Write speed in 2st row 6th col
      Delay_ms(100);
      if (RD0_bit ==0 && duty<250) //if button on RD0 pressed
      {
        Delay_ms(100);
        duty = duty + 10;  //increment current_duty
        PWM1_Set_Duty(duty);  //Change the duty cycle
      }
      if (RD1_bit ==0 && duty >0) //button on RD1 pressed
      {
        Delay_ms(100);
        duty = duty - 10;  //decrement duty
        PWM1_Set_Duty(duty);
      }
      if (RD2_bit ==0 && duty >0) //button on RD2 pressed
      {
        Delay_ms(100);
        duty = 0;  //reset duty
        PWM1_Set_Duty(duty);
      }
    
    #10936
    Ligo George
    Keymaster

    Yes, you can. You have two options.

    1. Multiplex UART using IC 74HC4052
    2. Using Software UART, which means that you can program any GPIO pin of PIC as UART. MikroC Pro provides built in library for that.
    #10870

    In reply to: USART PIC16F877A

    Ligo George
    Keymaster

    MikroC functions are 100% working..

    You can use the following MPLAB XC8 tutorial to write your own functions.

    Using UART with PIC Microcontroller – MPLAB XC8

    #10865
    ericJ
    Participant

    I have used the c code for the USART module from the tutorial. I can not get it to work. I am using MikroC Pro with the EasyPIC 7. I know the compiler has its own function for initializing the module but I would like to write my own. Please help.

    #10227
    nitin ahuja
    Participant

    I want to display data read from UART on 16×2 LCD with MikroC compiler & PIC16F877A microcontroller …
    In my program I am sending data through USART terminal of MikroC, it is receiving correctly on virtual terminal in Proteus but not displaying on LCD.
    Please check the code written in MikroC

    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; 
    
    char gps; 
    void main() 
    { 
      Lcd_Init(); 
      Lcd_Cmd(_LCD_CLEAR); 
      Lcd_Cmd(_LCD_CURSOR_OFF); 
      Lcd_Out(1,1,"log"); 
      Lcd_Out(2,1,"lat"); 
    
      UART1_Init(9600); 
    
      here: 
        if (UART1_Data_Ready() == 1) 
        { // if data is received 
          gps = UART1_Read(); 
          delay_ms(100); 
        } 
        Lcd_Out(1,6,gps); 
        Delay_ms(2000); 
        goto here; 
      }
    
    #9419
    Ligo George
    Keymaster

    Hello, I used 8MHz crystal in that project.. You may use 4MHz or 20MHz. Just need to edit it in MikroC project settings.
    Use 1/4 watt resistors… .. and select 0.47 ohm fusible resistor as per your current requirements.

Viewing 15 results - 16 through 30 (of 37 total)
>