Rainbow-electronics MAX1402 Manual de usuario Pagina 33

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 40
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 32
MAX1402
+5V, 18-Bit, Low-Power, Multichannel,
Oversampling (Sigma-Delta) ADC
______________________________________________________________________________________ 33
/* Low-level function to write 8 bits
** The example shown here is for a bit-banging system with (CPOL=1, CPHA=1)
*/
void WriteByte (BYTE x)
{
drive SCK pin high
count = 0;
while (cout <= 7)
{
if (bit 7 of x is 1)
drive DIN pin high
else
drive DIN pin low
drive SCK pin low
x = x * 2;
drive SCK pin high
count = count + 1;
}
}
/* Low-level function to read 8 bits
** The example shown here is for a bit-banging system with (CPOL=1, CPHA=1)
*/
BYTE ReadByte (void)
{
x = 0;
drive SCK pin high
count = 0;
while (cout <= 7)
{
x = x * 2;
drive SCK pin low
if (DOUT pin is high)
x = x + 1;
drive SCK pin high
count = count + 1;
}
}
return x;
Figure 15. Bit-Banging SPI Replacement
V
DD
P3.0
P3.1
RESET
DOUT
DIN
SCLK
CS
8051
MAX1402
Figure 14. MAX1402 to 8051 Interface
Vista de pagina 32
1 2 ... 28 29 30 31 32 33 34 35 36 37 38 39 40

Comentarios a estos manuales

Sin comentarios