Does anyone know how I can make a C program that assigns hexadecimal values to a whole row in a 4x4 array? Each row would have one value.(0x00,0xff, 0x55, and 0xff) It then needs to sum all of the elements which I can do.
#include "msp430g2553.h"
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
//--------------------------------------------------------------------------
//char type is one byte; int type is two bytes; volatile to prevent optimization
//------------------------------------------------------------------------------
volatile unsigned int i=0, j=0, sum=0; // sum is the sum of the indices
int Zeroes = 0x00, Ones = 0xff, Odds = 0x55, Evens = 0xaa;
unsigned char ArrayFill [4][4];
//------------------------------------------------------------------------------
// Initialize ArrayFill to 0xff
//------------------------------------------------------------------------------
{
for (i=0; i<=3; i++)
for (j=0; j<=3; j++)
ArrayFill[i][j] = 0xff;
}
//------------------------------------------------------------------------------
// Fill ArrayFill with the indices values and calculate the sum of the indices
//------------------------------------------------------------------------------
{
for (i=0; i<=3; i++)
{
for (j=0; j<=3; j++)
{
ArrayFill[i][j] = ????????;
sum=??????;
}
}
}
sum = sum;