??? 10/21/09 03:02 Read: times |
#169922 - The first after it Responding to: ???'s previous message |
After getting the basic idea of a correctly working program, i made my own one. with the idea that the DPTR is already a 16 bit register and therefore i dont need to make the value a correct 16 bit, i used it.
The program is as under this program is same as the previous but just the values of DPTR is moved and also, i have placed R1 as a checking register of the MSBYTE and LSBYTE of DPTR ORG 000H JMP MAIN ORG 023H JMP SERIAL ORG 030H MAIN: MOV SCON,#50H MOV TMOD,#20H MOV TH1,#-24 SETB TR1 SETB EA SETB ES MOV R1,#01 MOV DPTR,#0000H MOV SBUF,DPH JMP$ SERIAL: CLR TI DJNZ R1,SKIP MOV R1,#02 ; here you can see that the value of R1 is 2 here so first it will send the MSBYTE and than LSBYTE MOV SBUF,DPL INC DPTR RETI JMP$ SKIP: MOV SBUF,DPH RETI END I checked this program and i thought that it worked correctly as it was transmitting two different bits serially. and one(LSB) was changing continously but the MSB was same for 256 LSB. |