
$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
