I have the following simplified code and I need to have a formula take a uint16_t. This value however comes from multiple sources (ie multiple types) depending on who is calling the formula. The two issues I currently see in the debugger...
1. pTx assignment how do I do this ?
2. after I run the program the prtnVals don't look anything like the assignments??
Can someone please help.
Code:
/** * main.c
*/
#include <msp430.h>
#include <stdint.h>
#pragma LOCATION (pwmDiv, 0x1800);
#pragma PERSISTENT(pwmDiv);
volatile uint16_t pwmDiv = 50;
uint16_t itoa(uint16_t k);
union rtnVals
{
volatile uint16_t Memory;
float avg;
};
union rtnVals *prtnVals;
uint16_t test, lowByte = 2;
uint16_t *pTx = **prtnVals;
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
prtnVals->avg = 4454.0;
prtnVals->Memory = pwmDiv;
test = itoa((((*pTx)) >> (4 * lowByte)) & 0x0F);
}
uint16_t itoa(uint16_t k)
{
if (k <= 9)
return '0' + k;
else
return 'A' + (k - 10);
}
https://cboard.cprogramming.com/imag...AAAElFTkSuQmCC