Tool/software: Code Composer Studio
Good Day
I declared an array:
BYTE C3_SMBus_Data[16] = {
0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
The code that writes to this array collects a byte of data from an SMBus state machine that returns a byte variable
SMBus_Buffer:
case C3_Capture_Cmd: // Store second byte of the packet into the command byte.
if( C3_BYTE_READ != ( C3_BYTE_READ & SMBus_Flags ) ) { // Wait for byte read to finish.
C3_SMBus_Command = SMBus_Buffer;
SMBus_Flags |= C3_BYTE_READ; // Enable the next C3 byte read.
Data_Array_Length = 0; // Initialize the byte count/array index.
// Oscilloscope trigger
P1OUT &= ~M_LED7; // Turn on LED7.
C3_SMB_Recv_State = C3_Capture_Data;
}
break;
case C3_Capture_Data: // Store the remainder of the packet into the data array.
P1OUT |= M_LED7; // Turn off the LED7.
if( C3_BYTE_READ != ( C3_BYTE_READ & SMBus_Flags ) ) { // Wait for byte read to finish.
C3_SMBus_Data[0] = SMBus_Buffer; // Save the packet data.
C3_Byte_Rd_State = C3_Byte_Init;
C3_SMB_Recv_State = C3_SMB_Recv_Idle;
}
break;
SMBus_Buffer on return contains the correct value, in this case 0x20, but the array element index 0 never changes value and even the presets in the BYTE declaration are not displayed as expected.
#define BYTE unsigned char
Please advise.