#include /* common defines and macros */ #include /* derivative information */ #pragma LINK_INFO DERIVATIVE "mc9s12c128" /* ECE348, Spring 2016 Group ## 18-348 lab 1 program 1 This program computes a digest of a string and puts the value out on 8 bits of LED. To run in simulation, no wiring is required. Just verify/observe the final value of PTT. NOTE: Wire MCU Pin 13 to LED1 Wire MCU Pin 15 to LED2 Wire MCU Pin 50 to LED3 Wire MCU Pin 52 to LED4 Wire MCU Pin 54 to LED5 Wire MCU Pin 56 to LED6 Wire MCU Pin 58 to LED7 Wire MCU Pin 60 to LED8 */ /* change the below string to be your name or lab partner names! */ char test_string[] = "Bert Ernie"; void main(void) { unsigned char accum = 0; /* accumulator for hash of string */ int i = 0; EnableInterrupts; /* set up port T for output */ DDRT = 0xFF; //direction is output PERT = 0x00; //no pullup MODRR = 0x00; //route pins to port T /* compute 8-bit hash of string value */ while (test_string[i] != 0) { accum = accum + test_string[i] + accum; i = i + 1; } /* set data line to computed value */ PTT = (unsigned char)accum; for(;;) { } /* wait forever */ /* please make sure that you never leave this function */ }