DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Assembly (http://www.daniweb.com/forums/forum125.html)
-   -   Programming for the SCI interface (http://www.daniweb.com/forums/thread160666.html)

laguna92651 Dec 4th, 2008 3:07 am
Programming for the SCI interface
 
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


All times are GMT -4. The time now is 5:34 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC