Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

MPLAB Warnings

Status
Not open for further replies.

AtomSoft

Well-Known Member
How do i create my own warnings in MPLAB?

Like in VB6 i would...

debug.print "my message"

and it would place that in a window in the bottom. How can i do the same for mplab? i know its possible
 
You need the error directive,
Code:
        if $>1234
        error  "Out of memory"
        endif

Edit, you can also use messsage if you don't want the assembler to stop.

Mike.
 
Last edited:
works now the problem is ... is sudden....

I want to debug my code. Like if it runs into a certain area then load the warning/error

#warning works like #error only on compile
 
Last edited:
You can't do that in your source as the compiler doesn't know where the linker will put the code. You have to change the linker script.

Mike.
 
ok ill tell you what i did to get what i want...

I made a array 40 bytes long:

unsigned char debug[40];

Now everytime i use this variable array i clear it using:

memset(debug,0,40);

Now i create break points to determine very easy the status of certain things:

sprintf (debug, "Init OK!");

Now using the watch window i can see if it passed or failed without going through code.
 
Last edited:
another example:

Code:
    res = pf_mount(&fs);
#ifdef DEBUGON
    memset(debug,0,40);
    if(!res)
        sprintf (debug, "Mount FS Passed!");
    else
        sprintf (debug, "Mount FS Failed!");
#endif
 
Plz i have problem when compile the file and tell me that in the Output:
----------------------------------------------------------------------
Debug build of project `D:\TEST\TEST.mcp' started.
Language tool versions: mpasmwin.exe v5.34, mplink.exe v4.34, mcc18.exe v3.34
Preprocessor symbol `__DEBUG' is defined.
Sun Dec 27 19:52:45 2009
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Deleted file "D:\TEST\TEST.mcs".
Clean: Done.
Build aborted. The project contains no source files.
----------------------------------------------------------------------
Debug build of project `D:\TEST\TEST.mcp' failed.
Language tool versions: mpasmwin.exe v5.34, mplink.exe v4.34, mcc18.exe v3.34
Preprocessor symbol `__DEBUG' is defined.
Sun Dec 27 19:52:45 2009
----------------------------------------------------------------------
BUILD FAILED
 
Plz i have problem when compile the file and tell me that in the Output:
----------------------------------------------------------------------
Debug build of project `D:\TEST\TEST.mcp' started.
Language tool versions: mpasmwin.exe v5.34, mplink.exe v4.34, mcc18.exe v3.34
Preprocessor symbol `__DEBUG' is defined.
Sun Dec 27 19:52:45 2009
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Deleted file "D:\TEST\TEST.mcs".
Clean: Done.
Build aborted. The project contains no source files.
----------------------------------------------------------------------
Debug build of project `D:\TEST\TEST.mcp' failed.
Language tool versions: mpasmwin.exe v5.34, mplink.exe v4.34, mcc18.exe v3.34
Preprocessor symbol `__DEBUG' is defined.
Sun Dec 27 19:52:45 2009
----------------------------------------------------------------------
BUILD FAILED


listen you have to add the files to the project panel
thats all
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top