Cirrus-logic AN118 Manual do Utilizador Página 13

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 32
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 12
AN118
AN118REV2 13
P3 = 0xFF; /*Use the alternative function of Port 3*/
EA = 0x00; /*Disable all interrupts*/
SCON = 0x72; /*8 bit UART*/
/*Set TI to enable TXSER UART function*/
/*Transmission Rate is 9600,N,8,1*/
TMOD = 0x20; /*Use TIMER1, 8-bit auto-reload */
TH1 = 0xFD; /*Initialize Auto-reload to FD for 11.059MHz external clock*/
PCON = 0x00; /*when set we run at 19200 Baud, 9600 when clear*/
TCON = 0X40; /*Turn internal UART timer on*/
for(j=0;j<2047;j++){ /*Delay 2048 SCLK cycles, ... */
SCLK = 0x01; /*to allow oscillator to start*/
SCLK = 0x00;
}
/*Reset Serial Port*/
SDI = 1; /*SET SDI PIN*/
for(j=0;j<254;j++) {
SCLK = 0x01; /*SET SCLK*/
SCLK = 0x00; /*CLR SCLK*/
}
SDI = 0; /*RESET SDI PIN*/
SCLK = 0x01; /*SET SCLK*/
SCLK = 0x00; /*CLR SCLK*/
mode = P0 & 0x01; /*Test Mode Pin*/
/*if Mode = 0, three wire mode ...*/
/*if Mode = 1, four wire mode. ...*/
/* NOTE: To change mode board must be Reset.*/
}
/**************************************************************/
/* Routine - write_to_register */
/* Input - command, low, mid, high */
/* Output - none */
/* Description - This routine is used to write to any internal */
/* register. */
/**************************************************************/
void write_to_register(char command,char low,char mid,char high){
if(mode == 1) P1 = 0xF4; /* Clear CSb */
transfer_byte(command);
transfer_byte(high);
transfer_byte(mid);
transfer_byte(low);
if(mode == 1) P1 = 0xF5; /* Set CSb */
}
Vista de página 12
1 2 ... 8 9 10 11 12 13 14 15 16 17 18 ... 31 32

Comentários a estes Manuais

Sem comentários