Programming for the SCI interface

Reply

Join Date: Nov 2008
Posts: 7
Reputation: laguna92651 is an unknown quantity at this point 
Solved Threads: 0
laguna92651 laguna92651 is offline Offline
Newbie Poster

Programming for the SCI interface

 
0
  #1
Dec 4th, 2008
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?

  1. org $800
  2. address rmb 20
  3. movb #$00,SCOBDH ; set baud rate to 19,200
  4. movb #$26,SCOBDL
  5. movb #$03,SCOSR1 ; M=0, Wake=0, ILT=0, PE=1 & PT=1
  6. movb #$08,SCOSR2 ; TE=1
  7. movb #$00,DDRB ; initialize Port A as input
  8.  
  9. gets_sc0 jsr getc_sc0
  10. ldx address
  11. cmpa #$04
  12. beq exit
  13. staa 1,x+
  14. bra gets_sc0
  15.  
  16. exit clr 0,x
  17. swi
  18.  
  19. getc_sc0 brclr SCOSR1, $20,* ; wait until RDRF is set
  20. ldaa SCODRL ; read character
  21. rts
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Assembly Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC