| ??? 11/18/03 04:14 Read: times |
#58866 - RE: Thank you Responding to: ???'s previous message |
I have a pin P2.0 that is set as a carrier detect input. When the pin goes low this starts my timing routine which monitors the incoming data on P2.1. The data rate is 300 baud so I set up a timing routine to basically bit bangs the incoming data at a 300 baud rate. I have include a bit of the code that does this timing routine. I did not come up with this code it was something I found on the net, I just modified it to fit my need. This is still a learning process for me.
++++++++++++++++++++++++++++++++++++++++++++++++++ RXBIT set P2.1 ;Receive LTR data on this pin CARDET set P2.0 ;Detect incoming carrier ;The serial baud rate is determined by the processor crystal, and this constant which is calculated as: (((crystal/baud)/12) -5) / 2 ;BITTIM EQU 45(11059200/9600)/12) -5) / 2)= 45 BITTIM EQU 1533 ; Set for 300 baud START: MOV R1,#8 K0: JNB CARDET,$ K1: MOV R0,#BITTIM ;Wait full bit-time DJNZ R0,$ ;For DATA bit MOV C,RXBIT ;Read bit RLC A ;Shift it into ACC DJNZ R1,K1 ;read 8 bits CJNE A,#0ACH,START ;Sync pattern was received ++++++++++++++++++++++++++++++++++++++++++++++++++++++ I have the code set right now to only read the first 8 bits. If this works I will then work on reading the 9th bit. I am sure there is a better way to do this, so I am open to any suggetions to make this better. Craig |
| Topic | Author | Date |
| Bit Bang Question | 01/01/70 00:00 | |
| Algorithm... | 01/01/70 00:00 | |
| RE: >8 bits | 01/01/70 00:00 | |
| 9 bits | 01/01/70 00:00 | |
| RE: Bit Bang Question | 01/01/70 00:00 | |
| RE: Thank you | 01/01/70 00:00 | |
| RE: Thank you | 01/01/70 00:00 | |
| RE: Thank you | 01/01/70 00:00 | |
| RE: Thank you | 01/01/70 00:00 | |
| RE: Thank you | 01/01/70 00:00 | |
| RE: Thank you | 01/01/70 00:00 | |
RE: Thank you | 01/01/70 00:00 |



