Difference between revisions of "Example io demo"

From wiki.emacinc.com
Jump to: navigation, search
(Usage for io_demo)
(Usage for io_demo)
Line 66: Line 66:
  
 
Now we can press '''a''', '''c''', '''i''' or '''r''' to run a demo; or '''x''' to exit.
 
Now we can press '''a''', '''c''', '''i''' or '''r''' to run a demo; or '''x''' to exit.
+
 
 +
====Know Your Carrier Board
 +
 
 
[[File:portABC_gpio_header_and_LEDs_location.jpg|frame|left|Pictured in our usage examples below is the SOM-150ES that we used for testing. Other carrier boards will have a similar layout. Note the locations of the GPIO header and LED strip.]]
 
[[File:portABC_gpio_header_and_LEDs_location.jpg|frame|left|Pictured in our usage examples below is the SOM-150ES that we used for testing. Other carrier boards will have a similar layout. Note the locations of the GPIO header and LED strip.]]
 
<br clear=all>
 
<br clear=all>
 +
 +
'''TODO indicate the analog IO port too'''
 +
 
'''HEY MIKE, I COULD HAVE PICTURES OF ALL THE CARRIER BOARDS, EACH WITH THEIR LEDS AND GPIO INDICATED. WHAT DO YOU THINK?'''
 
'''HEY MIKE, I COULD HAVE PICTURES OF ALL THE CARRIER BOARDS, EACH WITH THEIR LEDS AND GPIO INDICATED. WHAT DO YOU THINK?'''
  

Revision as of 14:56, 23 December 2013

TODO: {{#todo:InProgress(12.05.13-12:47->JG+)|Jgreene|oe 4,oe 5,jg,md,Review}}

This is a guide to the io demo C example project included in the EMAC OE SDK.

The io_demo project provides four examples of carrier board IO:

  • An analog-to-digital converter demo.
  • A counter demo.
  • An input-to-output demo.
  • A ring demo.

The io_demo project builds one executable: io_demo.

Opening, Building and Uploading the Project Files

1. Open the C/C++ editing perspective.

stub

2. Open the project files.

stub

3. Build the project.

stub

4. Upload the binary to the target machine.

stub

Usage and Behaviour

Hardware Requirements

To use the io demo program you will need the following hardware.

File:Som150 with SoM.jpg
This is a SOM-150ES carrier board carrying a SoM


Usage for io_demo

Run io demo from the console. It takes no parameters.

 ./io_demo

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.

====Know Your Carrier Board

File:PortABC gpio header and LEDs location.jpg
Pictured in our usage examples below is the SOM-150ES that we used for testing. Other carrier boards will have a similar layout. Note the locations of the GPIO header and LED strip.


TODO indicate the analog IO port too

HEY MIKE, I COULD HAVE PICTURES OF ALL THE CARRIER BOARDS, EACH WITH THEIR LEDS AND GPIO INDICATED. WHAT DO YOU THINK?

Usage Example. A/D Demo

stub

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. 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 process is also reflected in the strip of 8 LEDs on the board (LD1-LD8). 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).

File:Gpio portc detail.jpg
Details of GPIO Header : Port C. Note that half of the GPIO header is ground. Also note that Port C starts on the second header pin.


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>

This is the ribbon cable that we made for our input-to-output demo. Note that we connect PortC:pin0 to PortB:pin0; PortC:pin1 to PortB:pin1; etc.
Iodemo homemaderibboncable.jpg

Here's our cable plugged into the GPIO header. You see that PortC:pin0 outputs to PortB:pin0; PortC:pin1 outputs to PortB:pin1; etc. Iodemo homemaderibboncable closeup.jpg

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.

500px

The board lights the LEDs in numeric sequence, 1-8, then repeats; looping until a key is pressed.