the serial communication interface sci mc9s12 c32 l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
The Serial Communication Interface (SCI) MC9S12-C32 PowerPoint Presentation
Download Presentation
The Serial Communication Interface (SCI) MC9S12-C32

Loading in 2 Seconds...

play fullscreen
1 / 23

The Serial Communication Interface (SCI) MC9S12-C32 - PowerPoint PPT Presentation


  • 551 Views
  • Uploaded on

The Serial Communication Interface (SCI) MC9S12-C32. Lecture L4.9. Reference. HCS12 Serial Communications Interface (SCI) Block Guide V02.08. S12SCIV2.pdf. PIM_9C32 Block Diagram. SCI module. SCI. Asynchronous Serial I/O The 68HCS12 SCI Interface Programming the SCI

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'The Serial Communication Interface (SCI) MC9S12-C32' - adamdaniel


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
reference
Reference

HCS12 Serial Communications Interface

(SCI)

Block Guide

V02.08

S12SCIV2.pdf

slide3

PIM_9C32

Block Diagram

SCI module

slide4
SCI
  • Asynchronous Serial I/O
  • The 68HCS12 SCI Interface
  • Programming the SCI
  • SCI Interface Using Interrupts
slide6
SCI
  • Asynchronous Serial I/O
  • The 68HCS12 SCI Interface
  • Programming the SCI
  • SCI Interface Using Interrupts
slide15
SCI
  • Asynchronous Serial I/O
  • The 68HCS12 SCI Interface
  • Programming the SCI
  • SCI Interface Using Interrupts
slide16

sci.asm

; SCI0

SC0BDH EQU $C8 ;baud rate control

SC0CR1 EQU $CA ;SCI control reg 1

SC0CR2 EQU $CB ;SCI control reg 2

SC0SR1 EQU $CC ;SCI status reg

SC0DRL EQU $CF ;SCI data reg

RDRF EQU $20 ;SCSR mask

; INITIALIZE SCI

sci0_init

CLR SC0CR1 ;8 bit

LDD #52

STD SC0BDH ;9600 baud

LDAA #$0C

STAA SC0CR2 ;enable tx & rx

RTS

slide17

; INPUT BYTE FROM SERIAL PORT INTO A

INCHAR

LDAA SC0SR1 ;check status

ANDA #RDRF ;check rdrf

BEQ INCHAR ;wait for char

LDAA SC0DRL ;get char in A

RTS

; OUTPUT BYTE IN A TO SERIAL PORT

OUTPUT

TST SC0SR1

BPL OUTPUT ;loop until tdre

STAA SC0DRL ;send A

RTS

slide19

sciecho.asm

; echo char to PC

org $4000

sci_echo

bsr sci0_init

se1 bsr inchar

bsr output

bra se1

#include sci.asm

slide20
SCI
  • Asynchronous Serial I/O
  • The 68HCS12 SCI Interface
  • Programming the SCI
  • SCI Interface Using Interrupts
slide21

; SCI Interface using interrupts File: SCIINT.WHP

; display characters from PC keyboard on LCD display

SC0BDH EQU $C8 ;baud rate control

SC0CR1 EQU $CA ;SCI control reg 1

SC0CR2 EQU $CB ;SCI control reg 2

SC0SR1 EQU $CC ;SCI status reg

SC0DRL EQU $CF ;SCI data reg

RDRF EQU $20 ;SCSR mask

SCI0.IVEC EQU $0FD8 ;SCI0 user vector address + 2

ORG $4000

main

jsr spi_init ;initialize spi

jsr lcd_init ;initialize lcd

jsr initq ;initialize queue

jsr sci0_init ;initialize sci

mn1 jsr checkq ;if queue is empty

bcs mn1 ; wait

jsr data8 ;store char on LCD

ldy #3

jsr ms_delay ;delay ~10 ms

bra mn1

slide22

; INITIALIZE SCI

sci0_init

SEI ;disable interrupts

CLR SC0CR1 ;8 bit

LDD #52

STD SC0BDH ;9600 baud

LDAA #$2C

STAA SC0CR2 ;enable tx & rx, RX INT

LDD #SCI_INTSER

STD SCI0.IVEC ;set sci int vector

CLI ;enable interrupts

RTS

slide23

; Interrupt service routine: get char and store in queue 

SCI_INTSER

LDAA SC0SR1

ANDA #RDRF

BEQ SI1 ;if RDRF set

LDAA SC0DRL ;read data (clears RDRF flag)

JSR QSTORE ;and store it in queue

SI1 RTI

#INCLUDE QUEUE.ASM

#INCLUDE LCD.ASM