Question 7.24: Write an 8051 C program to calculate the checksum byte for t...

Write an 8051 C program to calculate the checksum byte for the data 25H, 62H, 3FH, and 52H.

The blue check mark means that this solution has been answered and checked by an expert. This guarantees that the final answer is accurate.
Learn more on how we answer questions.
#include <reg51.h>

void main(void)

{

unsigned char mydata[]={0x25,0x62,0x3F,0x52};
unsigned char sum=0;
unsigned char x;
unsigned char chksumbyte;
for (x=0;x<4;x++)

{

P2=mydata[x];
sum=sum+mydata[x];
P1=sum;

}

chksumbyte=~sum+1;
P1=chksumbyte;

}

Related Answered Questions

Question: 7.11

Verified Answer:

//Toggling an individual bit #include <reg51.h&...
Question: 7.33

Verified Answer:

#include <reg51.h> sbit P1b0=P1^0; sbit regA...
Question: 7.32

Verified Answer:

#include <reg51.h> sbit P1b0=P1^0; sbit ACCM...
Question: 7.31

Verified Answer:

#include <reg51.h> sbit P1b0=P1^0; sbit regA...
Question: 7.30

Verified Answer:

#include <reg51.h> sbit P1b0=P1^0; sbit regA...
Question: 7.26

Verified Answer:

#include <reg51.h> void main(void) { unsigne...