laguna92651 0 Newbie Poster

I'm new to assembly language and have written an instruction sequence for the MC68HC12 ,to input a string of characters using the SCI channel 0. The input character string, will be no more than 20 characters, and will be stored in memory when an EOT character is received.
Port A bit 0 will be used for parity error detection.

The serial data transfer will be performed according as follows;
o 19,200 baud (P clock is 8 MHz)
o one start bit, 8 data bits, one stop bit
o polled output
o idle line wakeup
o short idle line mode
o no loop back
o characters should be encoded using odd parity

Is this the correct approach and how would I add an interrupt driven input?

org   	$800
address		rmb	20
	movb	#$00,SCOBDH	; set baud rate to 19,200
	movb	#$26,SCOBDL
	movb	#$03,SCOSR1	; M=0, Wake=0, ILT=0, PE=1 & PT=1
	movb	#$08,SCOSR2	; TE=1
	movb	#$00,DDRB	; initialize Port A as input

gets_sc0	jsr	getc_sc0
		ldx	address	
		cmpa	#$04
		beq	exit
		staa	1,x+
		bra	gets_sc0

exit		clr	0,x
		swi

getc_sc0	brclr	SCOSR1, $20,*	; wait until RDRF is set
		ldaa	SCODRL	; read character
		rts
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.