Using the Static I/O

Static input/output pins are used for either sensing or generating change-of-state instances. With the Analog Discovery 2's and Digital Discovery's 16-channel I/O, there are several options for doing just that.


Inventory

  • 1 Analog Discovery 2 or Digital Discovery
    • You may also use the Analog Discovery or the Electronics Explorer Board with WaveForms. There are some slight differences in functionality between the Analog Discovery, the Analog Discovery 2, and the Electronics Explorer Board, but nothing that will prevent you from following along if you have one of the other tools.
  • A computer with USB port to run the software

Step 1: Static I/O

There isn't much to cover as far background material for static input/output, so let's get started. If you want some help getting your Analog Discovery 2 set up and calibrated, or installing WaveForms, check out this quick start guide .

Before we start, note that the digital channels are not meant to be used as sources for large loads. Don't connect much more than a single LED and resistor directly to the channel. If you need to drive larger loads, the channels can be used to trigger high current drivers such as MOSFETs, H-bridges, etc., but are not to be used as primary sources.

Once you have your Analog Discovery 2 and WaveForms software all set up, open the static I/O by clicking on the “StaticIO” button, as displayed below in Fig. 1.

Figure 1. Static I/O button.

The static I/O window will open.

Figure 2. Static I/O window.

The first thing to note here is that unlike other tools, the static I/O window opens with the tool running.

Figure 3. Static I/O running.

By default, none of the digital pins are set as outputs, so you shouldn't have any immediate issues with shorting. It is recommended that you stop the tool before doing any pin re-configuration.

There are two main areas: control options are at the top, and the channel configurations take up the bulk of the window space.

At the top you have a few control options:

Figure 4. Control options.

  • “File” allows you to save the current static I/O project, open a saved project, or close the static I/O tool window.
  • “Control” gives access to the tool's run and stop commands.
  • Under “View”, there is one setting for turning on names for each I/O pin. With “Show Name” checked, a small label box appears below each pin with a default name that matches the label on the 30-pin header. This name can be edited to identify the signal as it applies to your application. Figure 5. View. Channel names can only be applied to individual channels when you have access to them. Some settings group all eight channels into one reading, in which case you can't change the name. More on that in a bit.
  • “Window” provides access to the help screen and also lets you browse between any WaveForms tool windows you may have open.

Step 2: Channel Configuration

Each digital channel is set as an input, specifically a virtual LED, by default. A logic high value on any pin turns on the corresponding LED in the window to reflect the change in state on that pin in real time.

Figure 6. Window LED.

The Analog Discovery 2 has 16 digital logic pins, labelled 0-15. They are broken into two groups; 0-7 and 8-15. On the left side you have some controls for each group of 8.

Figure 7. Digital logic controls.

  • “Bit IO” is checked by default and lets you see the whole group of 8 pins as the same type.
  • Selecting “Last IO” resets all 8 channels to the last setting of each channel if you were to switch the whole group to one of the bus options.
  • LED” is the default and sets all channels to input with a virtual LED displayed. The LED will light up when a logic high is detected. The Analog Discovery 2 defaults to 3.3V for logic high for both input and output, but all digital pins are 5V input tolerant. Up to ±20V overvoltage is supported in the event of accidental overvoltage on one of the digital pins.
  • “Button” contains a small menu of options for different types of buttons with various combinations of output states based on whether the button is pressed or released.

Figure 8. Button menu.

  • In Fig. 8 above, “1” corresponds to a ligic high and “0” is a logic low. “Z” is a high impedance state, which means that the output value is neither high nor low. There is no output at all, so the state is undetermined. In practice, “Z” state will usually be far enough below the logic high state to turn off whatever is connected, but it is not technically considered to be in the low state. Also note that there is no way to “hold” a button in a pressed state. They are truly momentary.
  • “Switch” has similar options to “Button” except that the output will hold in whatever state you switch it to until you switch it out of that state. You also have the option of three-state switches, with “Z” between “1” and “0”.

Figure 9. Switch options.

Each channel can also be individually configured for LED, button, or switch by clicking on the small number associated with each channel. Only that channel will be configured, allowing you to configure any channel however you want.

Below “Bit IO” in the group control, you'll see “Slider”, “Progress bar”, and “7-segment”. Each of these settings configures that group of channels as one 8-bit bus

  • “Slider” is an 8-bit output bus. As you move the slider to the right, the equivalent decimal value will display in a small box on the right. You can directly enter any value between 0 and 255 in this box. This value will be represented in binary on the 8 corresponding pins, with the highest channel number representing the most significant bit (MSB).

Figure 10. Slider.

  • “Progress bar” is an 8-bit input bus. The 8 channels are used to indicate a value represented in binary with the highest channel number representing the MSB. On the right you will see the equivalent decimal value.

Figure 11. Progress bar.

  • The last option is “7-segment”, which takes all 8 channels and assigns each to a segment in a virtual 7-segment display, including a decimal point. Each channel number is displayed on the 7-segment for ease in assigning values.

Figure 12. 7-segment.


Step 3: Wrapping Up

The static I/O tool is extremely simple and easy to use, but remember the warning stated previously:

The digital channels are not meant to be used as sources for large loads. Don't connect much more than a single LED and resistor directly to the channel. If you need to drive larger loads, the channels can be used to trigger high current drivers such as MOSFETs, H-bridges, etc., but are not to be used as primary sources.