Datasheet

TB3067
DS93067A-page 4 © 2011 Microchip Technology Inc.
FIGURE 4: PIC
®
Microcontroller Code Example for Forced Power-Down Mode.
/* design specific */
#define TXPINLATCbits.LATC6
#define CSPINLATCbits.LATC0
/* please refer to data sheet regarding maximum values */
#define WaitTimeTx2CS() Nop(); Nop();Nop(); Nop();
#define WaitTimeCSactive() unsigned char dly; dly = 55; while(--dly);
/**********************************************************************/
/**********************************************************************/
void ForcedSleepMCP200x(void)
{
/* set LATregister of corresponding IOpin for TX -> 0 */
TXPIN = 0;
/* depending if TXEN in TXSTA register allows the use of the
/* corresponding IOpin for TX as a normal IO when TXEN = 0 then set */
/* TXPIN = 0 otherwise reset the whole UART module. Please refer to */
/* controller specific data sheet and review the UART section */
#if defined (TXEN_FREE_IO) /* TX also usable as IO */
TXEN = 0;
#else
RCSTA = 0;
#endif
WaitTimeTx2CS(); /* refer to data sheet */
CSPIN = 1; /* CS = 1 -> transceiver activated but TX = 0 */
WaitTimeCSactive(); /* refer to data sheet */
CSPIN = 0; /* CS = 0 -> transceiver in SLEEP mode */
}
/**********************************************************************/
/**********************************************************************/