Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/02/05 02:26
Read: times


 
#96411 - Serial problems Help me!
For some reason When i send a end byte in hyper terminal It just quits the serial interrupt then reloads back up again. I cant figure out why. I cleared the recieve byte as soon as I store it. and I stop any timer0 interrupts by clearing et0 then reanabling it. But for some reason in hyperterminal my MCU works fine once i type something in the keyboard in Hyperterminal Its prints HI then echos back me the the text. when I send ΓΏ chr(255) 11111111 to the screen it Prints HI again. so for some wierd reason its ending the serial interrupt and starting it right back up.

Can ssomeone help me out? thanks heres my code


SERIAL:
push acc
push psw
push 00h
push 01h
mov psw,#010h
clr a
mov g,a
clr et0
CLR TI
MOV SBUF,#048h
JNB TI,$
CLR TI
MOV SBUF,#049h
JNB TI,$
WHILE:
JNB RI,$ ;Wait for the 8051 to set the RI flag
MOV A,SBUF ;Read the character from the serial port
mov r1,a
clr RI
mov a,#080h
add a,g ; Set the address location to write to
mov r0,a
mov a,r1
mov @R0,a ; Write to the specific program address
mov a,r1 ; If RI is set move the byte from the serial buffer to acc A
cpl a ; compliment a, to test for end program byte.
jz NORECI ; If recieve byte = FF(which is our end byte) exit loop
jmp NEWBUF
NEWBUF:
inc g ; Incriment the address counter
CLR TI ;Be sure the bit is initially clear
MOV SBUF,r1
JNB TI,$ ;Pause until the TI bit is set.
sjmp WHILE ; Loop
NORECI:
clr a
mov g,a
mov k,a ; ******* Clears the k byte which will restart the main program
setb et0
pop 01h
pop 00h
pop psw
pop acc
reti ; Return

List of 8 messages in thread
TopicAuthorDate
Serial problems Help me!            01/01/70 00:00      
   saving R0 R1 in bank 0 but using bank 2            01/01/70 00:00      
      hmm            01/01/70 00:00      
         ah crap your right            01/01/70 00:00      
            Fixed that, but still have the problem            01/01/70 00:00      
               Exact Requiremet            01/01/70 00:00      
                  k            01/01/70 00:00      
   NEVERMIND            01/01/70 00:00      

Back to Subject List