We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am having a problem with get and set nvram over a spi bus. The set function shown below has always worked with "Char array" and "int" types, but will not work with "int array'. Thanks in advance for any help. Call; NewPreheatMinutes[3] NVRAM_GetVariable(NVRAM_PREHEAT_MINUTES, NewPreheatMinutes); Function definition: void NVRAM_SetVariable(enum NVRAM_VARIABLE VariableID, void *Value) { char spi_buff[3]; case NVRAM_RETHERM_MINUTES: spi_buff[0] = RethermMinutesByte0MsbAddr | WriteBit; spi_buff[1] = (*(int*)(Value + 0) & 0xFF00) >> 8; Spi_SendData(CLOCK, 2, spi_buff); spi_buff[0] = RethermMinutesByte0LsbAddr | WriteBit; spi_buff[1] = *(int*)(Value + 0) & 0xFF; Spi_SendData(CLOCK, 2, spi_buff); spi_buff[0] = RethermMinutesByte1MsbAddr | WriteBit; spi_buff[1] = (*(int*)(Value + 1) & 0xFF00) >> 8; Spi_SendData(CLOCK, 2, spi_buff); spi_buff[0] = RethermMinutesByte1LsbAddr | WriteBit; spi_buff[1] = *(int*)(Value + 1) & 0xFF; Spi_SendData(CLOCK, 2, spi_buff); spi_buff[0] = RethermMinutesByte2MsbAddr | WriteBit; spi_buff[1] = (*(int*)(Value + 2) & 0xFF00) >> 8; Spi_SendData(CLOCK, 2, spi_buff); spi_buff[0] = RethermMinutesByte2LsbAddr | WriteBit; spi_buff[1] = *(int*)(Value + 2) & 0xFF; Spi_SendData(CLOCK, 2, spi_buff); break;
Stefan, This is the fix! int *ptr; ptr=(int *)Value; Then replace all subsequent "Value" with "ptr". Thank You Mark