Difference between revisions of "Example io demo"
(→Know Your Carrier Board)
(→Know Your Carrier Board)
|Line 30:||Line 30:|
This is a detail of the GPIO header. Pin 49 is hot. 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.
This is a detail of the GPIO header. Pin 49 is hot. The bottom pins2,4,6...46,48,50are 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.
Revision as of 13:22, 3 January 2014
This is a guide to the
io demo C example project included in the EMAC OE SDK.
io_demo project provides four examples of SOM-150ES carrier board IO:
- An analog-to-digital converter demo.
- A counter demo.
- An input-to-output demo.
- A ring demo.
io_demo project builds one executable:
Opening, Building and Uploading the Project Files
Usage and Behaviour
To use the io demo program you will need the following hardware.
- An EMAC SOM-150ES carrier board.
- A compatible EMAC SoM for that carrier board (SOM-9260M, SOM-9G20M and SOM-9X25 are all compatible and available from EMAC).
- A multimeter or oscilloscope. See Usage Example. Input to Output Demo and Usage Example. Count Demo for details.
- A ribbon cable just long enough to reach from GPIO Port B to GPIO Port C. See Usage Example. Input to Output Demo for details.
Know Your Carrier Board
This is a detail of the GPIO header. Pin 49 is hot. 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.
Usage for io_demo
Run io demo from the console. It takes no parameters.
This brings up a menu of demos.
**************************** Demo Menu A/D Demo - a Count Demo - c Input to Output Demo - i Ring Demo - r Exit - x Enter Selection:
Now we can press a, c, i or r to run a demo; or x to exit.
Usage Example. A/D Demo
From the demo menu press -a.
did somebody say something about there already being an analog out built right onto the carrier board?
Usage Example. Count Demo
From the demo menu press c.
The system counts from 0 to 255 in binary. It takes about 15 seconds to complete.
The steps of this process are reflected in the GPIO PortC header pins (see Know Your Carrier Board, above). As each bit in our 8bit 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 Know Your 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).
Usage Example. Input to Output Demo
In this usage example the carrier board talks to itself. We send an 8bit data stream directly from Port B to Port C via a short piece of ribbon cable.
<detail of board. gpio header closeup with ports b and c labelled>
Our 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 synch after a few seconds. This is normal.
Usage Example. Ring Demo
Refer to the SOM-150ES carrier board surface mount LEDs LD1-LD8 for output.
The board lights the LEDs in numeric sequence, 1-8, then repeats; looping until a key is pressed.