beautypg.com

Select_port – Zilog Z8F0130 User Manual

Page 260

background image

Using the ANSI C-Compiler

UM013037-1212

236

Zilog Developer Studio II – Z8 Encore!
User Manual

RI

RI (restore interrupt) is a Zilog intrinsic function that restores interrupt status. It is
intended to be paired with an earlier call to TDI(), which has previously saved the existing
interrupt status. See the

TDI

section on page 239 for a discussion of that function. The

interrupt status to be restored is passed as a parameter to RI(). This function is an intrinsic
function and is inline expanded.

Synopsis

#include

intrinsic void RI(unsigned char istat);

Example

#include


void main(void)

{

unsigned char istat;

istat = TDI();/* Test and Disable Interrupts */

/* Do Something */

RI(istat);/* Restore Interrupts */

}

select_port

The

select_port

function is a Zilog function that selects the UART. The default is

_UART0. The

init_uart

function can be used to configure either _UART0 or _UART1

and select the UART passed as the current one for use. All calls to

putch

,

getch

, and

kbhit

use the selected UART. You can also change the selected UART using the

select_port

function without having to reinitialize the UART.

Synopsis

#include

int select_port( int port ) ;

Returns

A zero is returned on success; a nonzero is returned on failure.

Example

#include

#include

void main(void)

{


init_uart(_UART0,_DEFFREQ,_DEFBAUD);

init_uart(_UART1,_DEFFREQ,_DEFBAUD);

select_port(_UART0);

printf("Hello UART0\n"); // Write to uart0