Keil™, An ARM® Company

Discussion Forum

Can't simulate the Serial Port??

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
gary X31
Posted
8-Jan-2005 19:48
Toolset
C51
New! Can't simulate the Serial Port??
Dear ALL,
I have tried to program the serial port and simulated the serial port under the Keil.
But it seems could work.
All the related registers I have checked.
The program just won't get into the uart_sub and loop in the main_loop.


;;Test Program
;;UART always send 0x41h out

org 0000h
ljmp start

org 0023h ;serial communication int
ljmp uart_sub

org 0030h

start:

mov sp,#060h

;------UART Setting Start---------------------------------------------
mov tmod,#00100000b ;Timer0 Mode1,Timer1 Mode2
mov th1,#0fdh
setb tr1

mov scon,#01010000b ;enable Receive
mov ie,#10010000b ;enable UART Interrupt
;------UART Setting End-----------------------------------------------


main_loop:

;;UART test start

mov a,#041h
mov sbuf,a

jmp main_loop
;;UART test end







;;------------------------------------------
;;
;; UART Subroutine Start
;;
;;------------------------------------------

uart_sub:
push psw
push acc
jbc ri,rcv_data
clr ti
jmp uart_done

rcv_data: COM port got data
mov a,sbuf
mov uart_buffer,a

uart_done:
pop acc
pop psw

reti


;;---------------------------------------------------------------------------------
;;
;; UART Subroutine End
;;
;;---------------------------------------------------------------------------------

end
Read-Only
Author
A.W. Neil
Posted
9-Jan-2005 20:49
Toolset
C51
New! RE: Can't simulate the Serial Port??
You need to start by reading the uVision Getting Started Guide, and working through the example projects in it.
This will give you a proper introduction to the tools, how they work, and how to use them - rather than just jumping-in blindly at the deep end.

(The uVision Getting Started Guide is available on the 'Books' tab in the 'Project' Window; The 'Books' window is also available via the 'Help' menu; failing all that, search for GS51.PDF in your Keil folder)

Having done this, you should know how to use the simulates serial port...

Next Thread | Thread List | Previous Thread Start a Thread | Settings