Difference between revisions of "Example io demo"

From wiki.emacinc.com
Jump to: navigation, search
m (Approved for Final Draft status.)
m (Reverted edits by Mdean (talk) to last revision by Jgreene)
Line 1: Line 1:
{{todo|FinalDraft (12.05.13-12:47->JG+);(01.03.14-16:40->MD+)|Jgreene|project=oe 4,oe 5,jg,md,FinalDraft,mw}}This is a guide to the <code>io demo</code> C example project included in the EMAC OE SDK.The <code>io_demo</code> project provides four examples of SOM-150ES carrier board IO:<br />* An analog-to-digital converter demo.* A counter demo.    * An input-to-output demo.* A ring demo.The <code>io_demo</code> project builds one executable: <code>io_demo</code>.== Opening, Building and Uploading the Project Files ==stub== Usage and Behaviour =====Hardware Requirements===To use the '''io demo''' program you will need the following hardware.* An EMAC [http://www.emacinc.com/som/som150es.htm SOM-150ES] carrier board. <br />* A compatible EMAC SoM for that carrier board ([http://www.emacinc.com/products/system_on_module/SoM-9260M SOM-9260M], [http://www.emacinc.com/products/system_on_module/som-9G20m SOM-9G20M] and [http://www.emacinc.com/products/system_on_module/som-9x25 SOM-9X25] are all compatible and available from EMAC).<br />* A multimeter or oscilloscope. See [http://wikidev.emacinc.com/wiki/Example_io_demo#Usage_Example._Input_to_Output_Demo Usage Example. Input to Output Demo] and  [http://wikidev.emacinc.com/wiki/Example_io_demo#Usage_Example._Count_Demo Usage Example. Count Demo] for details.<br />* A ribbon cable long enough to reach from GPIO Port B to GPIO Port C. See [http://wikidev.emacinc.com/wiki/Example_io_demo#Usage_Example._Input_to_Output_Demo Usage Example. Input to Output Demo] for details.<br />====Know Your Carrier Board====[[File:know_your_som_150.jpg|frame|left|SOM-150ES carrier board with GPIO, LEDs and analog IO indicated.]]<br clear=all>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. [[File:gpio_header_detail.png]]===Usage for io_demo===Run '''io demo''' from the console. It takes no parameters.<syntaxhighlight lang="text"> ./io_demo</syntaxhighlight>This brings up a menu of demos.<br /><syntaxhighlight lang="console">****************************     Demo Menu                                         A/D Demo            - a    Count Demo          - c    Input to Output Demo - i    Ring Demo            - r                               Exit                - x                               Enter Selection: </syntaxhighlight>Now, press '''a''', '''c''', '''i''' or '''r''' to run a demo; otherwise, press '''x''' to exit.===Usage Example. A/D Demo===From the demo menu, press '''a'''.<syntaxhighlight lang="text">****************************     Demo Menu                                         A/D Demo            - a    Count Demo          - c    Input to Output Demo - i    Ring Demo            - r                               Exit                - x                               Enter Selection: aA/D Demo[0]=126 [1]=11B [2]=12C [3]=12B </syntaxhighlight>The output shows the stray charge on the inputs being read by the analog-to-digital converter on pins 11, 12, 13, 14. This is the HDR8 ANALOG IO header.===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.<br />The steps of this process are reflected in the GPIO PortC header pins (see [http://wikidev.emacinc.com/wiki/Example_io_demo#Know_Your_Carrier_Board Know Your 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 [http://wikidev.emacinc.com/wiki/Example_io_demo#Know_Your_Carrier_Board 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 8-bit data stream directly from Port B to Port C via a short piece of ribbon cable. This is the ribbon cable for our 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|]]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 sync 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.[[File:Io demo led action sample 2.png | 500px]]The board lights the LEDs in numeric sequence, 1-8, then repeats, looping until a key is pressed.
+
{{todo|InProgress(12.05.13-12:47->JG+)|Jgreene|project=oe 4,oe 5,jg,md,Review}}
 +
This is a guide to the <code>io demo</code> C example project included in the EMAC OE SDK.
 +
 
 +
The <code>io_demo</code> project provides four examples of SOM-150ES carrier board IO:<br />
 +
* An analog-to-digital converter demo.
 +
* A counter demo.     
 +
* An input-to-output demo.
 +
* A ring demo.
 +
 
 +
The <code>io_demo</code> project builds one executable: <code>io_demo</code>.
 +
 
 +
== Opening, Building and Uploading the Project Files ==
 +
 
 +
stub
 +
 
 +
== Usage and Behaviour ==
 +
 
 +
===Hardware Requirements===
 +
 
 +
To use the '''io demo''' program you will need the following hardware.
 +
 
 +
* An EMAC [http://www.emacinc.com/som/som150es.htm SOM-150ES] carrier board. <br />
 +
* A compatible EMAC SoM for that carrier board ([http://www.emacinc.com/products/system_on_module/SoM-9260M SOM-9260M], [http://www.emacinc.com/products/system_on_module/som-9G20m SOM-9G20M] and [http://www.emacinc.com/products/system_on_module/som-9x25 SOM-9X25] are all compatible and available from EMAC).<br />
 +
* A multimeter or oscilloscope. See [http://wikidev.emacinc.com/wiki/Example_io_demo#Usage_Example._Input_to_Output_Demo Usage Example. Input to Output Demo] and  [http://wikidev.emacinc.com/wiki/Example_io_demo#Usage_Example._Count_Demo Usage Example. Count Demo] for details.<br />
 +
* A ribbon cable just long enough to reach from GPIO Port B to GPIO Port C. See [http://wikidev.emacinc.com/wiki/Example_io_demo#Usage_Example._Input_to_Output_Demo Usage Example. Input to Output Demo] for details.<br />
 +
 
 +
====Know Your Carrier Board====
 +
 
 +
[[File:know_your_som_150.jpg|frame|left|SOM-150ES carrier board with GPIO, LEDs and analog IO indicated.]]
 +
<br clear=all>
 +
 
 +
This is a detail of the '''HDR1 PLD & BUFFERED 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.  
 +
 
 +
[[File:gpio_header_detail.png]]
 +
 
 +
===Usage for io_demo===
 +
 
 +
Run '''io demo''' from the console. It takes no parameters.
 +
 
 +
<syntaxhighlight lang="text">
 +
./io_demo
 +
</syntaxhighlight>
 +
 
 +
This brings up a menu of demos.<br />
 +
<syntaxhighlight lang="console">
 +
****************************
 +
    Demo Menu            
 +
                           
 +
A/D Demo            - a     
 +
Count Demo          - c     
 +
Input to Output Demo - i     
 +
Ring Demo            - r  
 +
                           
 +
Exit                - x  
 +
                           
 +
Enter Selection:  
 +
</syntaxhighlight>
 +
 
 +
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'''.
 +
 
 +
<syntaxhighlight lang="text">
 +
****************************
 +
    Demo Menu            
 +
                           
 +
A/D Demo            - a     
 +
Count Demo          - c     
 +
Input to Output Demo - i     
 +
Ring Demo            - r  
 +
                           
 +
Exit                - x  
 +
                           
 +
Enter Selection: a
 +
 
 +
A/D Demo
 +
[0]=126 [1]=11B [2]=12C [3]=12B  
 +
</syntaxhighlight>
 +
 
 +
What you see there is low-level ambient signals (radio waves? astral perturbations?) being picked up by the analog-in pins 11,12,13,14. Press '''a''' a few times and watch the values change.
 +
 
 +
This is the HDR8 ANALOG IO header.
 +
 
 +
[[File:analog_io_header_detail.jpg]]
 +
 
 +
Let's do a couple of experiments on our analog in pins.  
 +
 
 +
Connect pin 20 to pin 11 (with, say, a double mini-grabber wire thingy). Hit '''a'''. Note that our first value is higher than the others. It should read '''3FF'''. That means that our first analog-in pin has 2.5V on it.
 +
 
 +
Connect pin 1 to pin 11. Hit '''a'''. Note that our first value is lower than the others. It's the vicinity of 0. That means that our first analog-in pin is getting grounded.
 +
 
 +
===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.<br />
 +
The steps of this process are reflected in the GPIO PortC header pins (see [http://wikidev.emacinc.com/wiki/Example_io_demo#Know_Your_Carrier_Board 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 [http://wikidev.emacinc.com/wiki/Example_io_demo#Know_Your_Carrier_Board 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. See [[http://wikidev.emacinc.com/wiki/Example_io_demo#Know_Your_Carrier_Board Know Your Carrier Board]], above, for details.
 +
 
 +
This is the suave 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.<br />
 +
[[File:iodemo_homemaderibboncable.jpg|500px|border|]]
 +
 
 +
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.
 +
[[File:iodemo_homemaderibboncable_closeup.jpg|500px|border|]]
 +
 
 +
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.
 +
 
 +
[[File:Io demo led action sample 2.png | 500px]]
 +
 
 +
The board lights the LEDs in numeric sequence, 1-8, then repeats; looping until a key is pressed.

Revision as of 16:45, 3 January 2014

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 SOM-150ES 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

stub

Usage and Behaviour

Hardware Requirements

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

Know Your 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 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.

Gpio header detail.png

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.

Usage Example. A/D Demo

From the demo menu press -a.

****************************
     Demo Menu              
                            
A/D Demo             - a    
Count Demo           - c    
Input to Output Demo - i    
Ring Demo            - r    
                            
Exit                 - x    
                            
Enter Selection: a

A/D Demo
[0]=126 [1]=11B [2]=12C [3]=12B

What you see there is low-level ambient signals (radio waves? astral perturbations?) being picked up by the analog-in pins 11,12,13,14. Press a a few times and watch the values change.

This is the HDR8 ANALOG IO header.

Analog io header detail.jpg

Let's do a couple of experiments on our analog in pins.

Connect pin 20 to pin 11 (with, say, a double mini-grabber wire thingy). Hit a. Note that our first value is higher than the others. It should read 3FF. That means that our first analog-in pin has 2.5V on it.

Connect pin 1 to pin 11. Hit a. Note that our first value is lower than the others. It's the vicinity of 0. That means that our first analog-in pin is getting grounded.

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. See [Know Your Carrier Board], above, for details.

This is the suave 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.