+ Post New Thread
Results 1 to 10 of 10
  1. #1
    Member level 2
    Points: 771, Level: 6

    Join Date
    Jun 2013
    Posts
    43
    Helped
    0 / 0
    Points
    771
    Level
    6

    Micro C PRO Programming Error

    Hai I am using Microc PRO IDE for my program develop, I am developing a program for ac voltage control (230vac control - using 0-5v dc proportional signal)
    Conditions and problems of my program given below
    When voltage is above 250 or below 180 output relay will trip and corresponding LED (LOW/HIGH) will glow. At the same time it write the voltage and time to EEPROM Memories consecutive locations and displays it on virtual terminal also. Up to this is working well in my program, but I am intending to implement one more function “Called()” in program to read EEPROM Contents manually by pressing 3 in keyboard . But when I am calling these function from main program , error signal starts, even “called ” function is empty or with some lines of instruction. In the attached program Called function is empty. The error signal shows some unwanted symbols in virtual terminal(one coma symbol in first line or sometimes other some symptom ). Also sometimes (with some statements in called function) gets blank in virtual terminal. I don’t know why happens like this. Is there any stack overflow ?. I have only experience in writing of small programs and this is the first time I am writing a large program like this. And I am not experienced with structured /modular style c programming.. Please Help me …
    Please Find the attached documents

    •   AltAdvertisment

        
       

  2. #2
    Advanced Member level 4
    Points: 7,943, Level: 21
    Achievements:
    7 years registered
    paulfjujo's Avatar
    Join Date
    Jun 2008
    Location
    France 01120
    Posts
    1,299
    Helped
    263 / 263
    Points
    7,943
    Level
    21

    Re: Micro C PRO Programming Error

    hello,

    what MCU ?
    post compiling windows message or log file ..
    any alerte message during compiling ?

    try to run you application with shorter lenght
    only ADC and UART,
    then add functionalities ie: with eeprom ...

    Divide and conquer, as they say.

    be carrefull with 230V AC measure .. and earth current leakage
    any galvanic insulation somewhere ?




  3. #3
    Member level 2
    Points: 771, Level: 6

    Join Date
    Jun 2013
    Posts
    43
    Helped
    0 / 0
    Points
    771
    Level
    6

    Re: Micro C PRO Programming Error

    here i am calling 5 functions from main function and program works well.When i am adding one more function ie,6th function it starts to show error, Typical example is showing in attached figure.



  4. #4
    Advanced Member level 4
    Points: 7,187, Level: 20

    Join Date
    Jan 2015
    Posts
    1,004
    Helped
    320 / 320
    Points
    7,187
    Level
    20

    Re: Micro C PRO Programming Error

    I think part of the problem is how you are defining 'Text2', 'Text4' and 'Text5'.
    You have:
    Code:
    unsigned char *Text2[7];
    where I think you should have
    Code:
    unsigned char Text2[7];
    and so on.
    The ".log" file contains warning messages about the usage of these in the "IntToStr" function call.
    There are other warnings that you are given by the compiler and you should probably clean those up as well (e.g. when you define a function without specifying a return type, it assumes "int" ad therefore generates the warning about not specifying a return value: try declaring the function as "void").
    Also I'm not clear on what functions you are referring to when you say you are calling 5 functions and then adding a 6th. Which are the 5 functions that are working and which is the 6th that is causing the problem?
    I suspect that you shoudl be using the debugging capabilities of your environment to single step through the code and that will help you locate where problems are occurring.
    Susan


    1 members found this post helpful.

    •   AltAdvertisment

        
       

  5. #5
    Advanced Member level 3
    Points: 3,996, Level: 14

    Join Date
    Aug 2015
    Posts
    773
    Helped
    142 / 142
    Points
    3,996
    Level
    14

    Re: Micro C PRO Programming Error

    Please zip and attach the complete mikroC PRO project files and Proteus file. I will fix it and post it here.

    Have you made the two resistors used on I2C Bus as Digital type in Proteus ? If not then make it Digital type by opening its properties.
    Last edited by pic.programmer; 11th December 2015 at 08:58.



  6. #6
    Member level 2
    Points: 771, Level: 6

    Join Date
    Jun 2013
    Posts
    43
    Helped
    0 / 0
    Points
    771
    Level
    6

    Re: Micro C PRO Programming Error

    Hai, Aussie Susan , The problem is no solved by changing Text2 but I am trying to change the errors in .log file.. And then we can check the error.

    Hai pic.programmer Here i am attaching the .zip file



    •   AltAdvertisment

        
       

  7. #7
    Advanced Member level 3
    Points: 3,996, Level: 14

    Join Date
    Aug 2015
    Posts
    773
    Helped
    142 / 142
    Points
    3,996
    Level
    14

    Re: Micro C PRO Programming Error

    According to mikroE the arrays used in the IntToStr() function should have a minimum length of 17 bytes. If you tell exactly how the device has to work then I will make necessary changes to the code.


    1 members found this post helpful.

  8. #8
    Advanced Member level 4
    Points: 7,943, Level: 21
    Achievements:
    7 years registered
    paulfjujo's Avatar
    Join Date
    Jun 2008
    Location
    France 01120
    Posts
    1,299
    Helped
    263 / 263
    Points
    7,943
    Level
    21

    Re: Micro C PRO Programming Error

    Quote Originally Posted by pic.programmer View Post
    According to mikroE the arrays used in the IntToStr() function should have a minimum length of 17 bytes..
    7 is enough ...for int or word (16bits)

    but error is there
    Code:
     unsigned char Text4[7];
    define and reserve some space for a table,
    the use a pointer to this table


    1 members found this post helpful.

  9. #9
    Advanced Member level 4
    Points: 7,187, Level: 20

    Join Date
    Jan 2015
    Posts
    1,004
    Helped
    320 / 320
    Points
    7,187
    Level
    20

    Re: Micro C PRO Programming Error

    Quote Originally Posted by sangeo View Post
    Hai, Aussie Susan , The problem is no solved by changing Text2 but I am trying to change the errors in .log file.. And then we can check the error.
    The version of the program in that zip file (with the date if 11 December at 19:01) still contains the wrong declaration for Text4 and Text5.
    Also you should change Text6 and Text7 in the same way - i.e. remove the '*'.
    Paulfjujo is saying the same thing in post #8.
    I suggest that you do a little reading up on when to use arrays, pointers and when storage is actually allocated and how much with various declaration statements.
    Susan


    1 members found this post helpful.

  10. #10
    Member level 2
    Points: 771, Level: 6

    Join Date
    Jun 2013
    Posts
    43
    Helped
    0 / 0
    Points
    771
    Level
    6

    Re: Micro C PRO Programming Error

    Hai That is It When i changed Text6 and Text7 from pointer to array every thing working well.. I thought the problem related to declaring a new function. But Aussie Susan and Paulfjujo guided me a lot to clear the Problem Thanks to Both of Aussie Susan and Paulfjujo...Helped me a lot....

    Happily sangeo



--[[ ]]--