U08232.c – Motorola USB08 User Manual

Page 113

Advertising
background image

Source Code Files

Contents

USB08 Evaluation Board

Designer Reference Manual

MOTOROLA

Source Code Files

113

U08232.C

//============================================================================

// File: U08232.C

// Func: RS232 Implementation Module for USB08 Demo Application

// Ver.: 1.00

// Auth: (C)2000,2001 by Oliver Thamm, MCT Elektronikladen GbR

// http://hc08web.de/usb08

// Rem.: View/Edit this File with TAB-Size=4

//============================================================================

//----------------------------------------------------------------------------

#include "hc08jb8.h"

// HC08JB8 Register Definitions

#include "u08232.h"

// Header File for RS232 Module

//----------------------------------------------------------------------------

//----------------------------------------------------------------------------

// Hardware Dependencies - Physical Port Usage for Software SCI Tx/Rx

// Change the following Definitions to meet your Hardware Requirements:

//----------------------------------------------------------------------------

// Transmit Line is PTC[0]

#define setTxLow()

(PTC &= ~0x01)

#define setTxHigh()

(PTC |= 0x01)

#define enaTxOut()

(DDRC |= 0x01)

// Receive Line is PTA[7]

#define tstRxLvl()

(PTA & 0x80)

#define enaRxIn()

(DDRA &= ~0x80)

//----------------------------------------------------------------------------

// Hardware Dependencies - SSCI Bit Timing generated by System Timer TIM

// Change the following Definitions to meet your Hardware Requirements:

//----------------------------------------------------------------------------

// clear TSTOP Bit in TSC Register to activate Counter

// PS0..PS2 Prescaler Bits in TSC Register must be 0 (default)

// so the Counter Rate is 3 MHz (0.333µs)

// 9600 Baud -> 104.1666 us per Bit -> 312.5 Clocks per Bit @ 3MHz

// 2400 Baud -> 416.6666 us per Bit -> 1250 Clocks per Bit @ 3MHz

// Adjust Value depending on Subroutine Call Overhead

//----------------------------------------------------------------------------

Advertising