custurd122000 0 Unverified User

This was an assignment for school a homework assignment but Im studying for the test and going over
the homework so I just wanted to know how to do this problem correctly he said it needed a various cjne statements
but I just dont know how to do it it doesnt have to run or anything its just a homework question

Question:

Write an 8051 program to continuously monitor P0. Implement the logic expressed in the following pseudo-code:
case ( P0)
 0xE0 :P1 = 0x1F; 
 0xC0 :P1 = 0x3F;
 0xA0 :P1 = 0x5F;
 0x80 :P1 = 0x7F; 
0x00 : P1 = 0xFF;
default:  P1 = 0xAA;
endcase

Heres what i did:

mov A, #AAh
again:       mov @P0, A
                 mov A, #E0h
                 mov P1, #1Fh
                 mov @P2, A
                 mov A, #C0h
                 mov P1, #3Fh
                 mov @P1, A
                 mov A, #A0h
                 mov P1, #5Fh
                 mov @P1, A
                 mov A, #80h
                 mov P1, #7Fh
                 mov @P1, A
                 mov A, #00h
                 mov P1, #FFh
                 mov @P1, A
                 DJNZ P1, again
                 end
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.