Electronics > Beginners

Hi-Tech C compiler variables

(1/5) > >>

Zedy:
hi!
I want to check some variables in RAM, is there some way to output them in MPLAB?
I have tried to use printf function to output variables to MPLAB SIM UART1, but it didn't work.

deef:
Variables that are specific to the compiler? Can you provide an example? Are you referring to the conditional "#PRAGMA" features?

If it's a microcontroller specific register, or variable in your software, I would suggest trying to simulate the code using MPLAB's Simulator and viewing the state of the variable between breakpoints in the WATCH window.

Zedy:

--- Quote from: deef on November 26, 2010, 06:10:49 am ---Variables that are specific to the compiler? Can you provide an example? Are you referring to the conditional "#PRAGMA" features?
If it's a microcontroller specific register, or variable in your software.

--- End quote ---
I have something like this: (variable is located into microcontroller RAM memory)

--- Code: ---#include <htc.h>

signed short U = 10;
signed short I = 11;
signed short P;

void
main (void){
P = U*I;

}
--- End code ---
And I want to see P, I have very limited knowledge in C, so I have read about "#PRAGMA" feature, but I don't know how I can use it.


--- Quote from: deef on November 26, 2010, 06:10:49 am --- I would suggest trying to simulate the code using MPLAB's Simulator and viewing the state of the variable between breakpoints in the WATCH window.

--- End quote ---
I would be very grateful, if you could make some dummy guide, how to make it work, last night I spend almost half a night, trying different solutions, but none of them worked.

Mechatrommer:
at menu debugger->select tool->mplab sim
double click code line will toggle breakpoint (round red B)
run (F9). if outdated, choose yes to rebuild and F9 again.
at menu view, choose anything simulated you want to see... local, file registers etc.
F6 to stop simulation. amien.

Zedy:

--- Quote from: shafri on November 26, 2010, 12:57:02 pm ---at menu debugger->select tool->mplab sim
double click code line will toggle breakpoint (round red B)
run (F9). if outdated, choose yes to rebuild and F9 again.
at menu view, choose anything simulated you want to see... local, file registers etc.
F6 to stop simulation. amien.

--- End quote ---
Thank you!, it works!

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version