#include int main(void) { unsigned char mydata[] = {0x25,0x62,0x3f,0x52}; unsigned char sum = 0; unsigned char x; unsigned char chksumbyte; ddra = 0xff; ddrb = 0xff; ddrc = 0xff; for(x=0;x<4;x++) { porta = mydata[x]; sum = sum + mydata[x]; portb = sum; } chksumbyte = ~sum + 1; portb = chksumbyte; return 0; }