| ??? 05/22/01 10:59 Read: times |
#11828 - RE: 8051 beginner: ports |
You write the numbers to a port in sequence.
To do that you can send the data directly to the port: like MOV Px,#your first data MOV Px,#your second data etc But this will be very fast and not particularly pretty ! The next step is to write delay code that holds up your sequence for a second or so per step perhaps. You can do that by the quick and dirty method timeblock: MOV r2,#128 MOV r3,#64 Loop1:nop loop2:DJNZ r3,loop2 DJNZ r2,loop1 RET Here the inner loop counts down from 64 before the outer loop counts 128 lots of 64, playing with the numbers will tune the speed to your crystal and hardware, but change the crystal changes the timings, and the whole processor stops doing other stuff to just sit on its ass and wait. Now your code is MAIN: MOV Px,#first number Acall timeblock MOV Px,#second number Acall timeblock . . . . . JMP main The next step is to use the onboard timers, but thats for another (brief) lesson Steve You really need to list the numbers in a little table |
| Topic | Author | Date |
| 8051 beginner: ports | 01/01/70 00:00 | |
| RE: 8051 beginner: ports | 01/01/70 00:00 | |
RE: 8051 beginner: ports | 01/01/70 00:00 |



