| ??? 01/07/03 06:28 Read: times |
#35826 - RE: 4 -> 16 ASM routines |
Many of the solutions suffer from the same problem: P0 is referenced twice. This produces inconsistancy in the conversion. Just as an example:
Suppose that at t(0), P0=0001 (bin). P0 is loaded into A and used to determine the output bit to be set (not yet the port number). In this case, this would be bit #1, so output byte = 00000010 At t(1), P0 changes to (say) P0=1010. Next, P0.3 is taken to determine to which port the output byte has to be moved to. As P0.3 is high, this would be P2. In effect, P1 would be 0 and P2 would be 02h: incorrect for both P0=0001 and P0=1010 as input. So ALWAYS make a snapshot of the input port and use the copied value to determine output data and port, OR do it the way Michael demonstrated in his second example (P0 referenced only once). |



