We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello iam working on cygnal microcontrollers c8051f124,iam performing checksum as i written below. The datas are written in external memoryarea when iam performing checksum at 4th byte operation iam exeeding the 8 bit register value ie sum=7b+ff=17a(378 inn decimal) but microcontroller is holding only 0x007a its ignoring overflow 1.but i defined sum as unsigned short int its not holding the overflow of ff value what i have to do now? johne char xdata test_string[100]_at_ 0x5555={0x0f,0x2e,0x3e,0xff,0xff,0x00,0xfe,0xff}; void main() { int x=8,y; unsigned short int sum=0; for(y=0;y<8;++y) { sum=sum+test_string[y]; if(sum>0xff) { sum=sum-0xff; } } test_string[y]=0xff-sum; test_string1[100]=test_string[100]; printf("checksum=%x\n",test_string[y]); }
See these threads for some ways to isolate your code from implementation-dependencies: http://www.keil.com/forum/docs/thread2472.asp http://www.keil.com/forum/docs/thread2836.asp http://www.keil.com/forum/docs/thread3097.asp