??? 09/14/10 03:38 Read: times |
#178552 - but it is ... Responding to: ???'s previous message |
I tried using the following code (from this site) and it behaves exactly the same , it sends the output three more times after i power down the circuit.
so what do the experts say . is it the hardware? something i need to do in the RS232 circuit? ;***************************************************************** ;This is an example of polled transmit ;***************************************************************** ; $MOD51 ; CR EQU 0DH LF EQU 0AH ; ORG 0 LJMP MAIN ; ORG 100H MAIN: LCALL SERINIT MOV DPTR,#HELLO LCALL TEXT_OUT MOV DPTR,#MSG1 LCALL TEXT_OUT MOV DPTR,#MSG2 LCALL TEXT_OUT LOOP: AJMP LOOP ;STOP HERE ;***************************************************************** ;Other Serial Messages ; HELLO: DB 'Hello World',CR,LF,0 MSG1: DB 'I am sending messages to my terminal!',CR,LF,0 MSG2: DB 'This is fun..',CR,LF,0 ;***************************************************************** SERINIT: ;Initialize serial port CLR TR1 CLR TI CLR RI MOV SCON,#01011010B ;TI SET INDICATES TRANSMITTER READY. ;MODE 1 REN MOV TMOD,#00100001B ;TIMER 1 MODE 8 BIT AUTO RELOAD MOV TH1,#0FDH ;TIMER RELOAD VALUE SETB TR1 ;START TIMER MOV DPTR,#SINIT LCALL TEXT_OUT RET ; SINIT: DB CR,LF DB 'Serial Port Initialized! ' CRLF: DB CR,LF,0 ;***************************************************************** TEXT_OUT: WT1: CLR A MOVC A,@A+DPTR INC DPTR JZ WT2 LCALL CHAR_OUT AJMP WT1 WT2: RET ;***************************************************************** CHAR_OUT: CLR TI MOV SBUF,A JNB TI,$ CORET: RET ;***************************************************************** END |