B&B Electronics Parallel Printer Card PIOC Bedienungsanleitung Seite 14

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 64
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 13
GHI Electronics,LLC USBwiz User Manual
Communication Interface selection
pins for handshaking. SPI_SSEL, SPI_SCK, SPI_MISO, and SPI_MOSI are the standard
SPI pins where SSEL is used for Slave Select, SCK is the Serial Clock (7Mhz running and
1.75Mhz for boot loader,) MISO is the data line going from USBwiz to your microcontroller,
and MOSI is the data line going from your microcontroller to USBwiz. The other two pins
are used for handshaking, they are DATARDY and BUSY. DATARDY pin goes high when
there is data in the USBwiz SPI buffer. When BUSY is high a user must not send any new
data to USBwiz.
The boot loader in SPI is half duplex. When DATARDY pin is high, USBwiz will not accept
any commands and will assume the SPI transaction is for reading the data; therefore, the
incoming data will be discarded. The other handshaking pin is BUSY. Before sending any
command to USBwiz this pin must be checked and data can be sent only when BUSY pin
is low.
On the other hand, the firmware runs SPI in full duplex mode. When SPI is full duplex,
USBwiz will accept any incoming data while it is sending simultaneously. If USBwiz has no
data to send back, it will send NDT (No Data Token.) The NDT is 0xff and is completely
ignored by USBwiz and should be ignored by your system as well. When reading data
from USBwiz but there is nothing to send, use NDT.
In some rare cases, there could be a need to send 0xFF (writing the hex value 0xFF, not
ASCII 0xFF!!) This is resolved by using HDT (Half Data Token.) HDT is the value 0xFE.
Whenever USBwiz or your system sees HDT, it must wait for one more byte to decide
what that value actually is. HDT followed by another HDT results in 0xFE; otherwise, it is
0xFF. Keep in mind 0xFF is always ignored even if it came after HDT.
Here is a simple ‘C’ code example:
Note that this example ignores the incoming data from SPI and it shouldn’t be used.
SendData(char c)
{
if( c == 0xFF )
{
SendSPI(0xFE);
SendSPI(0);
}else if (c == 0xFE )
{
SendSPI(0xFE);
SendSPI(0xFE);
}else
SendSPI(c);
}
Important: USBwiz requires the following in order for SPI to work:
SCK is output from your system
Rev.2.27 Page 14 of 64 www.ghielectronics.com
Seitenansicht 13
1 2 ... 9 10 11 12 13 14 15 16 17 18 19 ... 63 64

Kommentare zu diesen Handbüchern

Keine Kommentare