Digilent chipKIT Basic I/O Shield Podręcznik referencyjny - Strona 5
Przeglądaj online lub pobierz pdf Podręcznik referencyjny dla Systemy wejścia/wyjścia Digilent chipKIT Basic I/O Shield. Digilent chipKIT Basic I/O Shield 14 stron.
chipKIT™ Basic I/O Shield™ Reference Manual
Digilent has a set of libraries for using the Basic I/O Shield with the chipKIT MPIDE. The OLED library can be used
as-is or as a starting point for a more sophisticated graphics library.
It is contained in document # DSD-0000311 (chipKIT IOShield Library.zip) which can be downloaded from the Basic
I/O Shield product page at www.digilentinc.com. The OLED library is IOShieldOled.
Appendix B provides sample driver code for initializing the display and writing to it.
2.2
Discrete Digital I/O Devices
The Basic I/O Shield provides various discrete digital I/O devices. These can be accessed using the digitalRead and
digitalWrite functions. The pinMode function is used to set the pin to input or output.
When the buttons and switches on the Basic I/O Shield are not being used, the pins are available on the pass-
through shield connectors for use by other shields in the stack. The pins used by the LEDs are also available,
however the presence of the LEDs on the lines will load them down, possibly causing some devices to not work. It
is safe to use any of these pins as either inputs or outputs.
Pushbuttons: There are four pushbuttons labeled BTN1 (pin 4), BTN2 (pin 34), BTN3 (pin 36), and BTN4 (pin 37).
The digitalRead function will return low if the button is not pressed and high when the button is pressed.
Slide Switches: There are four slide switches labeled SW1 (pin 2), SW2 (pin 7), SW3 (pin 8) and SW4 (pin 35). The
digitalRead function will return low when the switch is down (toward the pushbuttons) and high when the switch is
up (toward the OLED display).
LEDs: There are eight LEDs labeled LD1 –LD8 that are accessed through digital pins 33 – 26. An LED is illuminated
when the corresponding pin is set to high using the digitalWrite function and off when set to low.
The LEDs are attached to the low eight bits of PORTE, with LD1 connected to PORTE bit 0, and LD8 connected to
PORTE bit 7. An 8-bit value written to PORTE (or LATE) will display the corresponding binary value on the LEDs.
2.3
Open Drain FET Outputs
The Basic I/O Shield has four open-drain FET outputs. These are low-side N-channel devices and can be used to
provide a digital switch closure to ground. These can be used to switch external loads such as relay coils, solenoids,
stepper motors, and so on.
An FET is used to switch an external load, such as a relay coil, on and off. The load is wired between the positive
side of an external power supply and the output of the FET. When the FET is switched on, current flows from the
external power supply through the load and the FET to ground.
FETs are often used to switch highly inductive loads, such as relay coils, solenoids, and motors. When the current
through an inductive load is switched off, a voltage spike will occur that can damage the FET. The Basic I/O Shield
has clamp diodes (also called snubber or flyback diodes) to clamp the voltage spike and feed the current back to
the external supply.
The NTHD4508N FETs are rated for a maximum V
maximum continuous current of 3.0A at 25ºC and 2.2A at 85ºC. For detailed specifications, see the data sheet
available at www.onsemi.com.
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
(voltage from drain to source) of 20V. They are rated for a
DS
Page 5 of 13