Renesas M16C/6N Manual de usuario Pagina 24

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 27
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 23
QDK™
M16C/Neutrino-NC30
www.state-machine.com/m16c
* b2 Reserved, set to 0
* b3 TXEPT Transmit register empty flag
* b4 CTS/RTS Disabled
* b5 NCH Data output select bit
* b6 CKPOL Clock polarity selected,TX falling edge,RX rising edge
* b7 UFORM MSB first
*/
u2c0 = 0x10;
u2tb = u2rb; /* clear UART2 receive buffer by reading it */
u2tb = 0; /* clear UART2 transmit buffer */
/* 00000101 UART2 transmit/receive control register 1
* b0 TE Transmit Enable Bit
* b1 TI Transmit buffer empty flag,
* b2 RE Receive enable bit,
* b3 RI Receive complete flag,
* b4 U1IRS Transmit buffer empty select,
* b5 U1RRM Disable continous receive mode,
* b6:b7 Reserved, set to 0
*/
u2c1 = 0x05;
(9) /* start the 16-bit Timer A, channel 1 to provide the time stamp for QS */
ta1mr = 0x40; /* Timer A1 in counter mode running from f8 */
ta1 = 0xFFFF; /* free-running down-counter */
ta1ic = 0; /* set interrutp priority (interrupt disabled) */
/* setup the QS filters... */
(10) QS_FILTER_ON(QS_ALL_RECORDS);
. . .
. . .
(11) return (uint8_t)1; /* indicate successfull QS initialization */
}
/*..........................................................................*/
(12) void QS_onCleanup(void) {
}
/*..........................................................................*/
(13) void QS_onFlush(void) {
uint16_t b;
while ((b =
QS_getByte()
) != QS_EOD) { /* next QS trace byte available? */
while (ti_u2c1 == 0) {
}
u2tb = b; /* stick the byte to the TX buffer */
}
}
/*..........................................................................*/
/* NOTE: invoked within a critical section (inetrrupts disabled) */
(14) QSTimeCtr QS_onGetTime(void) {
(15) if (ir_ta1ic != 0) { /* TimerA1 interrupt request set? */
(16) ++l_nTimerA1Underflows; /* account for 16-bit underflow (0->0xFFFF) */
(17) ir_ta1ic = 0; /* clear the interrupt flag */
}
/* subtract the Timer A1 counter, because it dounts DOWN */
(18) return ((uint32_t)l_nTimerA1Underflows << 16) - (uint32_t)ta1;
}
#endif /* Q_SPY */
Listing 11 QS implementation to send data out of the UART2serial port of the M16C
(1) The QS instrumentation is enabled only when the macro
Q_SPY
is defined
Copyright © Quantum Leaps, LLC. All Rights Reserved.
22 of 25
Vista de pagina 23
1 2 ... 19 20 21 22 23 24 25 26 27

Comentarios a estos manuales

Sin comentarios