|
|
Line 47: |
Line 47: |
| | | |
| Connect pin 1 to pin 11. Hit '''a'''. Note that the first value is lower than the others. It's the vicinity of 0. That means that the first analog-in pin is pulled down to ground. | | Connect pin 1 to pin 11. Hit '''a'''. Note that the first value is lower than the others. It's the vicinity of 0. That means that the first analog-in pin is pulled down to ground. |
− |
| |
− | ===Count Demo Usage===
| |
− |
| |
− | From the demo menu press '''c'''.
| |
− |
| |
− | The system counts from 0 to 255 in binary. It takes about 15 seconds to complete.<br />
| |
− | The steps of this process are reflected in the GPIO PortC header pins (see [[Example_io_demo#Carrier_Board | Carrier Board]], above). As each bit in our 8-bit register is set to 1, the corresponding pin in the PortC header momentarily registers 5 volts (easily detected with a multimeter or oscilloscope).
| |
− |
| |
− | More visibly, the counting process is also reflected in the strip of 8 LEDs on the board LD1-LD8. (see [[Example_io_demo#Carrier_Board | Carrier Board]], above). A lit LED indicates a 1 in our 8-bit register and an unlit LED indicates a 0. When the counting process is finished, all 8 LEDs are lit (255).
| |
− |
| |
− | ===Input to Output Demo Usage===
| |
− |
| |
− | In this usage example the carrier board talks to itself. We send an 8-bit data stream directly from Port B to Port C via a short piece of cable. See [[Example_io_demo#Carrier_Board | Carrier Board]], above, for details.
| |
− |
| |
− | This is the ribbon cable for the input-to-output demo. Note that we connect PortC:pin0 to PortB:pin0; PortC:pin1 to PortB:pin1; etc.<br />
| |
− | [[File:iodemo_homemaderibboncable.jpg|500px|border|]]
| |
− |
| |
− | Here's the cable plugged into the GPIO header. You see that PortC:pin0 outputs to PortB:pin0; PortC:pin1 outputs to PortB:pin1; etc.
| |
− | [[File:iodemo_homemaderibboncable_closeup.jpg|500px|border|]]
| |
− |
| |
− | The data stream for each pin is 1, 0, 1, 0, 1, 0... That is to say: all pins are set to 1, then they are all set to 0, then to 1 again, etc. We observe our data stream in the strip of 8 LEDs on the carrier board. They blink in unison.
| |
− |
| |
− | '''Note''' The blinking may get a little out of sync after a few seconds. This is normal.
| |
− |
| |
− | ===Usage Example. Ring Demo===
| |
− |
| |
− | From the demo menu press '''r'''.
| |
− |
| |
− | The system sets a bit on Port C to 1, then sets it to 0, then sets the bit after that to 1, then sets that pin to 0, and so on, sequentially. This shows a ring counter on the LED strip (see [[Example_io_demo#Carrier_Board | Carrier Board]], above).
| |
− |
| |
− | The steps of this process are reflected in the GPIO PortC header pins. As each bit in the 8-bit register is set to 1, the corresponding pin in the PortC header momentarily registers 5 volts (easily detected with a multimeter or oscilloscope).
| |
Revision as of 15:23, 2 July 2019
TODO: {{#todo:SEOKWREV (01.03.14-16:47->JG+);(01.03.14-17:35->MD+);(04.07.14-09:45->BS+);(04.09.14-16:15->BS+)|Jgreene|oe 4,oe 5,jg,md,SEOKWREV,ky,bs}}
This demo covers basic gpio usage for the IPAC single board computer, and 150 and 200 series carrier boards. This demo first cover gpio manipulation through the Linux terminal and then demonstrates gpio usage in a C program using an io example program.
Setup
Usage and Behavior
Hardware Requirements
To use the io demo program you will need the following hardware.
- An EMAC SOM-150ES carrier board with a compatible SoM
OR
- An EMC 200 carrier board with a compatible SoM
OR
OR
Carrier Board
SOM-150ES carrier board with GPIO, LEDs and analog IO indicated.
This is a detail of the HDR1 PLD & BUFFERED GPIO header. Pin 49 is Vcc. The bottom pins: 2, 4, 6...46, 48, 50; are all ground. Port A is pins 1, 3, 5, 7, 9, 11, 13, 15. Port B is pins 17, 19, 21, 23, 25, 27, 29, 31. Port C is pins 33, 35, 37, 39, 41, 43, 45, 47.
The output shows the stray charge on the inputs being read by the analog-to-digital converter on pins 11, 12, 13, 14. Press a a few times to watch the values change.
This is the HDR8 ANALOG IO header.
Let's do a couple of experiments on our analog in pins.
Connect pin 20 to pin 11 and hit a. Note that the first value is higher than the others. It should read approximately 3FF. This means that the first analog-in pin has 2.5V on it.
Connect pin 1 to pin 11. Hit a. Note that the first value is lower than the others. It's the vicinity of 0. That means that the first analog-in pin is pulled down to ground.