Communication


The arduino appears to have three main forms of communication SPI, TWI, UART.

SPI

Not knowing what anything does, the Serial Peripheral Interface (SPI) looks like an interesting way to go, since the quadrature decoder chip LS7366 (supplier)uses it. It is a "four-wire" serial bus that has the following lines:
  • SCK — Serial Clock (output from master)
  • MOSI/SIMO — Master Output, Slave Input (output from master)
  • MISO/SOMI — Master Input, Slave Output (output from slave)
  • SS — Slave Select (high->low transistion signals selection; output from master)
Some examples using SPI and the arduino platform are with interfacing eeprom and implementing a digital potentiometer.

The Arduino has a control register for setting the SPI parameters called SPCR. The register is filled as:

 7 6
 5 4 3 2 1 0
 SPIE SPE DORD MSTR CPOL CPHA SPR1 SPR0
  • SPIE - SPI interrupt (1 = enable, 0 = disable)
  • SPE - SPI communication (1 = enable, 0 = disable)
  • DORD - Data send format (1 = Least significant bit first, 0 = Most significant bit first)
  • MSTR - Slave/master mode (1 = master, 0 = slave)
  • CPOL - Clock idle mode (1 = idle when high, 0 = idle when low)
  • CPHA - Sample mode (1 = falling edge, 0 = rising edge)
  • SPR1, SPR0 - Two bits to set SPI speed (00 = 4MHz, 11=250KHz)

TWI

Another communication protocol, this is Two Wire Interface (TWI).  Like it sounds it uses two-wires for the serial interface. I might use this for a port expander, check out TI ICs for expanding the port.

UART

I checked out the Universal Asynchronous Receiver/Transmitter (UART).  I have a feeling this is mostly for the serial interface to the computer.  At the moment I don't know what else you can do with it.
Comments