Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

modulo-2 sum of the numbers

Status
Not open for further replies.

PG1995

Active Member
Hi

I was doing **broken link removed** problem. It's about 8051 assembly language butmy question has nothing to do with the programming or the assembly. I have looked up the definition of **broken link removed**. How come 1101+0011=1110. "1110" is modulo-2 sum in this case. Could you please help me with it? Thanks.

Regards
PG
 
1101+0011= 1110 (modulo 2 sum).
star summing from rightmost bit 1+1=10 (2 in decimal), hence dividing by 2 the remainder is 0 so 1+1=0 (modulo 2). also 0+1=1, 1+0=1,1+0=1.
hence
1101+0011= 1110 (modulo 2 sum).
 
Thank you, Mehtab Ali.

I understand it now and was able to find the relevant entry.

Regards
PG
 
Probably the most complicated explanation I have seen, especially if you are trying program with a mod2 function.
As already said, 0+0=0,0+1=1,1+0=1,1+1=0 i.e you only get a zero if both bit positions are the same.
This is what the xrl (XOR) instruction does in 8051. Better to look at your example of this and work simply by looking at each bit position individiually.
1 1 0 1 xrl
0 0 1 1
----------------------------------------------------------------------------------------------------- Result is 1110
=1 as they are different, =1 as they are different,=1 as they are different,=0 as they are the same

mov A,#0x0D; //1101
xrl A,#0x03; //0011

A will then be 0x0E ; // 1110
 
Last edited:
Looking at the number of postings asking for help, are we collectively doing your degree for you?

Hi

I have been here for more a year now. During all this time I have appeared in all the exams myself (final plus mid term exams account for 80% marks) and class performance, assignments, etc. account for the rest 20%. My performance has improved drastically since I joined the forums. Before that I was so hopeless that I was thinking quitting the studies and I really mean it. So, I would say I'm using the potential of the forums positively and to the fullest. I have seen members who come here make 3 or 4 postings and then just disappear. What matters the most that someone is really interested in the stuff he/she is studying and is following that path of pursuit of knowledge with all perseverance and hard work. Rather I would say good persons like MrAl, Ratch, misterT, Eric, Ian Rogers, and many others (I hope they won't mind not mentioning their names here - if they ever read this post) are helping me to make my dreams come true and I believe they should be happy and proud of this that they are affecting someone's life in a positive way. Thank you.

Regards
PG
 
Last edited:
I have no idea where you are posting from, but I did benefit from some excellent tutors during my studying. The ones who would happily stay for hours after time to try and get the message across.
They succeeded and I am forever thankful, so I guess this was a less modern use of help pre-computers on the net.
One of my best once told me that he got the greatest reward from seeing the lights come on in students who could rarely speak English. He had done his job for the day.
Somewhere I would like to be when I retire from this industry.
 
Somewhere I would like to be when I retire from this industry.

My best wishes for you. Well, that varies from one country, institution, department,etc. to another. You were fortunate in having good instructors. The good thing is one should do their best to learn whatever they are studying. By the way, you mentioned the students who could rarely speak English. Some years ago I wasn't able to write simple sentences in English, then I started learning English from good persons on the net and now I'm happy that I can at least get me message across. Further, when I sat for TOEFL iBT I was able pass the exam with 80% marks.

Regards
PG
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top