Zilog ZUSBOPTS Uživatelský manuál Strana 212

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 520
  • Tabulka s obsahem
  • ŘEŠENÍ PROBLÉMŮ
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 211
Run-Time Library UM017105-0511
184
Zilog Developer Studio II – ZNEO™
User Manual
void main(void)
{
unsigned short istat;
istat = TDI(); /* Test and Disable Interrupts
*/
/* Do Something */
RI(istat); /* Restore Interrupts */
}
select_port
select_port 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 <sio.h>
int select_port( int port ) ;
Returns
A zero is returned on success; a nonzero is returned on failure.
Example
#include <stdio.h>
#include <sio.h>
void main(void)
{
init_uart(_UART0,_DEFFREQ,_DEFBAUD);
init_uart(_UART1,_DEFFREQ,_DEFBAUD);
select_port(_UART0);
printf("Hello UART0\n"); // Write to uart0
select_port(_UART1);
printf("Hello UART1\n"); // Write to uart1
}
SET_VECTOR
SET_VECTOR is an intrinsic function provided by the compiler to specify the address of an
interrupt handler for an interrupt vector. Because the interrupt vectors of the ZNEO micro-
controller are usually in ROM, they cannot be modified at run time. The
SET_VECTOR
function works by switching to a special segment and placing the address of the interrupt
handler in the vector table. No executable code is generated for this statement. Calls to the
SET_VECTOR intrinsic function must be placed within a function body. The –reduceopt
compiler option does not affect the
SET_VECTOR function handling.
Zobrazit stránku 211
1 2 ... 207 208 209 210 211 212 213 214 215 216 217 ... 519 520

Komentáře k této Příručce

Žádné komentáře