Skip to main content
Application NoteNxp

Implementing SCI Receive and Transmit Buffers in C

This application note provides a C-language implementation of circular transmit and receive buffers for SCI modules on NXP M68HC16 and M68300 microcontrollers.

View application note

Overview

This document describes a software-based implementation of circular transmit and receive buffers for the Serial Communications Interface (SCI) on NXP M68HC16 and M68300 families, including MC68331, MC68332, MC68F333, and MC68336. It addresses the CPU efficiency limitations of single-byte hardware buffering by providing interrupt-driven software buffers. The implementation includes C code for SCI initialization, buffer status monitoring (qstat), and byte-level read/write functions (rx_byte, tx_byte). It specifically targets devices utilizing the Queued Serial Module (QSM) and is designed for easy porting between CPU16 and CPU32 architectures.

Use Cases

  • Optimizing CPU efficiency during asynchronous serial communication
  • Implementing interrupt-driven data handling for SCI modules
  • Buffering multi-byte serial data packets to prevent CPU stalling
  • Developing serial drivers for NXP M68HC16 or M68300 microcontrollers

Topics

SCI
Serial Communications Interface
Circular Buffer
MC68331
MC68332
MC68F333
MC68336
M68HC16
M68300
QSM
Queued Serial Module
Interrupt Handler

Referenced Parts

MC68331

NXP

On the MC68331 device, this functionality is included in the serial communications interface (SCI) part of the queued serial module (QSM).

MC68332

NXP

Configured for CPU32 devices with QSM (including MC68331, MC68332, MC68F333 and MC68336)

MC68336

NXP

Configured for CPU32 devices with QSM (including MC68331, MC68332, MC68F333 and MC68336)

MC68F333

NXP

Configured for CPU32 devices with QSM (including MC68331, MC68332, MC68F333 and MC68336)

M68300

NXP

Several devices in the Freescale M68HC16 and M68300 microcontroller families include asynchronous serial communications channels.

M68HC16

NXP

Several devices in the Freescale M68HC16 and M68300 microcontroller families include asynchronous serial communications channels.

Implementing SCI Receive and Transmit Buffers in C | Design Resources