| ??? 12/21/01 14:45 Read: times |
#17957 - RE: Still Learning, Need some suggestion |
Hi Carlos,
to affect only a single port pin there are powerful bit instructions available on the 8051. To read constant data from the program memory the "MOVC" was made. Following an example for your task: Peter <pre> clk_in equ p3.4 data_out equ p1.0 main: mov dptr, #message call send_message jmp main message: db message_end - message_start message_start: db 1, 2, 3, 10, 20 ;some bytes to send message_end: send_message: clr a movc a, @a+dptr mov r7, a ;get number of bytes send_byte_loop: inc dptr clr a movc a, @a+dptr mov r6, #8 send_bit_loop: rlc a ;rotate bits over CY jnb clk_in, $ jb clk_in, $ ;1-0 transition detect mov data_out, c ;write bit from CY to pin djnz r6, send_bit_loop djnz r7, send_byte_loop ret |
| Topic | Author | Date |
| Still Learning, Need some suggestions. | 01/01/70 00:00 | |
| RE: Still Learning, Need some suggestions. | 01/01/70 00:00 | |
| RE: Still Learning, Need some suggestions. | 01/01/70 00:00 | |
| RE: Still Learning, Need some suggestions. | 01/01/70 00:00 | |
| RE: Still Learning, Need some suggestions. | 01/01/70 00:00 | |
| RE: Still Learning, Need some suggestion | 01/01/70 00:00 | |
RE: Still Learning, Need some suggestion | 01/01/70 00:00 |



