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.

[SOLVED] Micro C PRO Programming Error

Status
Not open for further replies.

sangeo

Member level 2
Joined
Jun 2, 2013
Messages
44
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,647
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
 

Attachments

  • Programs.rar
    173.6 KB · Views: 125

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 ?

 

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.
 

Attachments

  • error.JPG
    error.JPG
    119.9 KB · Views: 238

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
 
  • Like
Reactions: sangeo

    sangeo

    Points: 2
    Helpful Answer Positive Rating
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:

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
 

Attachments

  • Programs fo edaboard.zip
    208.4 KB · Views: 127

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.
 
  • Like
Reactions: sangeo

    sangeo

    Points: 2
    Helpful Answer Positive Rating
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
 
  • Like
Reactions: sangeo

    sangeo

    Points: 2
    Helpful Answer Positive Rating
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
 
  • Like
Reactions: sangeo

    sangeo

    Points: 2
    Helpful Answer Positive Rating
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
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top