Sci - Hitachi Network Adapter H8 User Manual

Lowcost evaluation board
Table of Contents

Advertisement

HTEB1
User manual

3.3 SCI

SCI is used here for a simple RS232 (V24) terminal connection. Please use
a terminal program like HyperTerm (included in Windows), select
Baudrate 9600 Baud, 8 Databits, No Parity and 1 Stopbit (8N1). After
connection and setup, hit some keys and you will see a message
responding on every keycode sent.
/*
**-----------------------------------------------------------------------
**
** main.c - contains C entry point main()
**
**
This file was generated by HEW IAR Icch8 project generator
**
**-----------------------------------------------------------------------
*/
#include "mydefs.h"
/* some defines */
#define TIE
0x80
#define RIE
0x40
#define TE
0x20
#define RE
0x10
#define MPIE
0x08
#define TEIE
0x04
#define CK_INT
0x00
#define CK_INT_OUT
0x01
#define CK_EXT
0x02
#define IS_SCI_RDF
#define CLEAR_SCI_RDF
#define IS_SCI_TX_FREE
#define V24_BRR(x)
void V24Init (u16 Baudrate)
{
SCR3 = 0x00;
SSR = 0x00;
SMR = 0x00;
BRR = V24_BRR(Baudrate);
PMR1 |= 0x02;
SCR3 = (TE|RE|CK_INT);
}
u8 V24NewChar(void)
{
if (IS_SCI_RDF)
{
return TRUE;
}
return FALSE;
}
u8 V24GetChar(u8* data)
{
u8 idx;
if (IS_SCI_RDF)
{
*data = RDR;
CLEAR_SCI_RDF;
Issue 0.2
// see file for further include
(SSR & 0x40)
SSR = (SSR & ~0x40)
(SSR & 0x80)
((unsigned char)(((CPU_CLK+16*x)/32/x) - 1))
// disable all
// clear all errorbits
// 8N1 + /1 clock
// set baud
// P22 = TxD Output
// Ints und Data disabled, internal clock
// check for new char on V24
// Receive buffer full?
// simple GetChar via V24
// Receive buffer full?
// yes, get data
// clear RDRF-Bit
Page 39
07/2002

Advertisement

Table of Contents
loading

This manual is also suitable for:

H8/tiny 3664fHteb1

Table of Contents