| ??? 01/05/03 16:23 Read: times |
#35689 - RE: 4 -> 16 ASM routine needed |
It is very similar I agree.....but his solution has a problem with the issue that if the upper 4 bits of P0 are set to 1's. My ANL with #07H solves this problem.
You are correct that thesolution does not work correctly. It needs to be modified as follows: lookup: db 01h, 02h, 04h, 08h, 10h, 20h, 40h, 80h mov dptr,#lookup mov a,P0 anl a,#7H movc a,@a+dptr jb P0.3,setp2 mov P1,a mov P2,#0 sjmp done setp2: mov P1,#0 mov P2,a done: The modified solution now encodes as follows: P0.3->P0.0 P2.7->P2.0 P1.7->P1.0 0 0 0 0 00000000 00000001 0 0 0 1 00000000 00000010 0 0 1 0 00000000 00000100 0 0 1 1 00000000 00001000 0 1 0 0 00000000 00010000 0 1 0 1 00000000 00100000 0 1 1 0 00000000 01000000 1 1 1 1 00000000 10000000 1 0 0 0 00000001 00000000 1 0 0 1 00000010 00000000 1 0 1 0 00000100 00000000 1 0 1 1 00001000 00000000 1 1 0 0 00010000 00000000 1 1 0 1 00100000 00000000 1 1 1 0 01000000 00000000 1 1 1 1 10000000 00000000 |



