_nop_( );
_nop_( );
_nop_( );
_nop_( );
_nop_( );
_nop_( );
_nop_( );
_nop_( );
_nop_( );
_nop_( );
_nop_( );
_nop_( );
_nop_( );
_nop_( );
_nop_( );
_nop_( );
/////////////////////////////////////////////////////
//FIN del retardo
/////////////////////////////////////////////////////
//INICIO de la conversión
IOB |= StartConversión; //Pone el pin #CS en bajo para
iniciar conversión
while ( (IOB & bmBIT1) != 0x00 ) //Espera a que el pin
#INT se ponga en bajo
{
;
}
_nop_ (); //espera un ciclo de reloj por seguridad, aunque no
es necesario tampoco hace danno
Packet[i] = IOA; //Lee la salida del CAD
IOB &= EndConversion;
}
return (TRUE);
}
//-------------------------------------------------------------------------
// USB Interrupt Handlers
// The following functions are called by the USB interrupt
jump table.
//-------------------------------------------------------------------------
// Setup Data Available Interrupt Handler
void ISR_Sudav(void) interrupt 0
{
GotSUD = TRUE; // Set flag
EZUSB_IRQ_CLEAR();
USBIRQ = bmSUDAV; // Clear SUDAV IRQ
}
// Setup Token Interrupt Handler
void ISR_Sutok(void) interrupt 0
{
EZUSB_IRQ_CLEAR();
USBIRQ = bmSUTOK; // Clear SUTOK IRQ
}
void ISR_Sof(void) interrupt 0
{
EZUSB_IRQ_CLEAR();
USBIRQ = bmSOF; // Clear SOF IRQ
}
void ISR_Ures(void) interrupt 0
{
// whenever we get a USB reset, we should revert to full
speed mode
pConfigDscr = pFullSpeedConfigDscr;
((CONFIGDSCR xdata *) pConfigDscr)->type =
CONFIG_DSCR;
pOtherConfigDscr = pHighSpeedConfigDscr;
((CONFIGDSCR xdata *) pOtherConfigDscr)->type =
OTHERSPEED_DSCR;
EZUSB_IRQ_CLEAR();
USBIRQ = bmURES; // Clear URES IRQ
}
void ISR_Susp(void) interrupt 0
{
Sleep = TRUE;
EZUSB_IRQ_CLEAR();
USBIRQ = bmSUSP;
}
void ISR_Highspeed(void) interrupt 0
{
if (EZUSB_HIGHSPEED())
{
pConfigDscr = pHighSpeedConfigDscr;
((CONFIGDSCR xdata *) pConfigDscr)->type =
CONFIG_DSCR;
pOtherConfigDscr = pFullSpeedConfigDscr;
((CONFIGDSCR xdata *) pOtherConfigDscr)->type =
OTHERSPEED_DSCR;
}
EZUSB_IRQ_CLEAR();
USBIRQ = bmHSGRANT;
}
77
Comentários a estes Manuais