Electrical – Assembler language basics parity flag

assemblerbinaryflagmicrocontrollerparity

I am a beginner in assembler language I was reading some stuff online(belongs to a university) and I saw that
the P bit in psw after executing this instruction mov a,#03h A=0000 0011B so P=0
first it was difficult to know what is p bit after some research I thought it is parity bit and then you have to count the number of one bits in the result so the number of 1 bit in the result is 2 so it is an even number so P must be equal to one so why is P equal to zero here ?

Best Answer

It's probably an even parity bit.

The count of all the bits that are ones PLUS the parity bit should be an even number.

Examples:

\$0 0 0 0 0 0 1 1\$ \$Parity = 0\$, \$\Sigma= 2 + 0 = 2\$

\$0 0 0 0 0 0 0 1\$ \$Parity = 1\$, \$\Sigma= 1 + 1 = 2\$

\$0 0 1 0 1 0 1 1\$ \$Parity = 0\$, \$\Sigma= 4 + 0 = 4\$

\$0 1 1 0 0 1 1 1\$ \$Parity = 1\$, \$\Sigma= 5 + 1 = 6\$