Other Parts Discussed in Thread: EK-TM4C123GXL
Tool/software:
Hi,
I have a program where I measure a voltage and a current and i want to be able to print it in the console while debugging.
I use 2 variables, ui32Vbustest and ui32IShunttest, calculated with these functions:
void readVoltage() {
float fVBus_Float_Value;
I2C_LIBDataVBusGetFloat(&g_sI2C_LIBInst, &fVBus_Float_Value);
ui32Vbustest = (uint32_t) (fVBus_Float_Value * 1000); // Vbus unsigned int in milliVolts
}
void readCurrent() {
uint16_t ui16VShunt_RAW_Value;
I2C_LIBDataVShuntGetRaw(&g_sI2C_LIBInst, &ui16VShunt_RAW_Value);
ui32IShunttest = (((ui16VShunt_RAW_Value & 0x7FFF) * 10) / 8); // I Shunt unsigned int in milli Amper
}
According to this page, I added to my GEL file:
OnTargetConnect()
{
recordVariables();
}
menuitem "Record Variables";
hotmenu startTimer()
{
// GEL_SetTimer(milliseconds, timer_id, "callback");
// Parameters
// milliseconds: specifies the amount of time in milliseconds that should elapse between callbacks.
// timer_id: specifies a number to uniquely identify this timer.
// callback: is a string representing the GEL expression to evaluate every time the timer fires.
GEL_SetTimer(5000, 1, "recordVariables()");
}
hotmenu stopTimer()
{
// GEL_CancelTimer(timer_id);
// Parameter:
// timer_id: the id of the timer to cancel
GEL_CancelTimer(1);
}
recordVariables()
{
GEL_TextOut("Voltage test \n");
GEL_TextOut("Voltage: %u \n",,,,,ui32Vbustest);
GEL_TextOut("Current: %u \n",,,,,ui32IShunttest);
}
When I start debugging, the console shows this:
CORTEX_M4_0: GEL Output:
Memory Map Initialization Complete
CORTEX_M4_0: GEL Output: Voltage test
CORTEX_M4_0: GEL: Error while executing OnTargetConnect(): identifier not found: ui32Vbustest
at GEL_TextOut("Voltage: %u \n", 0, 0, 0, 0, ui32Vbustest) [tm4c1230c3pm.gel:147]
at recordVariables() [tm4c1230c3pm.gel:25]
at OnTargetConnect()
But when I declare a local int in GEL file, I can output it fine in the console.
How can I make the GEL output function display the value of a variable declared in the main.c file?
Thanks
