??? 09/09/10 03:10 Modified: 09/09/10 03:25 Read: times |
#178482 - strange behaviour in serial communication |
hi I have interfaced P89V51 with my pc using max233. I start the hyperterminal on pc and when i power up the microcontroller circuit , it sends the string correctly but when i power off the circuit it still sends 3 exact copies of the original string .
So if i run the code below it will send ">>>>>>>>>>>>>>TESTING SERIAL IO <<<<<<<<<<<<<<<<< " to the hyperterminal, and when i turn the power off on the controller , i see three more times ">>>>>>>>>>>>>>TESTING SERIAL IO <<<<<<<<<<<<<<<<<" ">>>>>>>>>>>>>>TESTING SERIAL IO <<<<<<<<<<<<<<<<<" ">>>>>>>>>>>>>>TESTING SERIAL IO <<<<<<<<<<<<<<<<<" on the hyperterminal. why is the circuit sending three more copies of the same data ? I have attached the RS232 circuit and the micro controller setup . Thanks Sami the assembly code is below $MOD51 ; ; The processor clock speed is 11.059MHz ; Cycle time is 1.1ms cr equ 0Dh lf equ 0Ah org 00 ljmp main org 100h main: mov scon,#40H ;mode 1, recv enable mov tmod,#20H ;timer 1 in auto reload mov th1,#00FDH ;9600 baud at 11.059MHz setb tr1 ;start timer 1 mov R1,#1 ;initialize counter clr ti ;clear for Xmitting loop: mov dptr,#msg ;pointer to the msg lcall send ;send the msg 1 times djnz R1,loop jmp $ ;wait forever send: mov a,#0 movc a,@a+dptr ;char from msg string cjne a,#99h,cont ;is msg sent ? if not continue ret cont: mov sbuf,a ;send the char jnb ti,$ ;wait for xmitter ready clr ti ;enable xmitter inc dptr ;point to next byte jmp send ;go send it msg: db '>>>>>>>>>>>>>>TESTING SERIAL IO <<<<<<<<<<<<<<<<<',cr,lf db 99h end |