Fundamental Hardware Concepts

Digital Pins

The digital pins on the 86Duino (which are mapped to the GPIO pins of the Vortex86EX SoC) can be configured as either inputs or outputs by the user at run time. We shall explains the functioning of the pins in those modes.

Properties of Pins Configured as INPUT

Digital pins of 86Duino default to inputs, so they don’t need to be explicitly declared as inputs with pinMode() when you’re using them as inputs. Pins configured this way are said to be in a high-impedance state. Input pins make extremely small demands on the circuit that they are sampling, which means that it takes very little current to move the input pin from one state to another. (Especially, referring to Arduino’s tutorials, one can make the pins useful for some special tasks as implementing a capacitive touch sensor, reading an LED as a photodiode, or reading an analog sensor with a scheme such as RCTime.)

This also means however, that pins configured as pinMode(pin, INPUT) with nothing connected to them, or with wires connected to them that are not connected to other circuits, will report seemingly random changes in pin state, picking up electrical noise from the environment, or capacitively coupling the state of a nearby pin.

Properties of Pins Configured as INPUT_PULLUP

There are 75K-ohms pullup resistors built into the Vortex86EX SoC that can be accessed from software. These built-in pullup resistors are accessed by setting the pinMode() as INPUT_PULLUP.

Due to the pullup resistor, when nothing is connected to a pin configured with INPUT_PULLUP, the pin will always report HIGH. And when connecting a sensor to the pin, the other end should be connected to ground; in the case of a simple switch, this causes the pin to read HIGH when the switch is open, and LOW when the switch is pressed.

The pullup resistors provide enough current to dimly light an LED connected to a pin that has been configured as an input. If LEDs in a project seem to be working, but very dimly, this is likely what is going on.

NOTE: Digital pins of 86Duino configured with INPUT or INPUT_PULLUP have 5V tolerant inputs, which means that these pins can accept 5 V without damage.

Properties of Pins Configured as OUTPUT

Pins configured as OUTPUT with pinMode() are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. 86Duino pins can source (provide positive current) or sink (provide negative current) up to 16mA (milliamps) of current to other devices/circuits. This is enough current to brightly light up an LED (don’t forget the series resistor), or run many sensors, for example, but not enough current to run most relays, solenoids, or motors.

Short circuits on 86Duino pins configured with OUTPUT, or attempting to run high current devices from them, may damage or destroy the output transistors in the pin, or damage the entire Vortex86EX SoC. Often this will result in a “dead” pin in the SoC but the remaining chip will still function adequately. For this reason it is a good idea to connect OUTPUT pins to other devices with 470-ohms or 1K-ohms resistors, unless maximum current draw from the pins is required for a particular application.

PWM

Pulse Width Modulation, or PWM, is a technique for getting analog results with digital means. Digital control is used to create a square wave, a signal switched between on and off. This on-off pattern can simulate voltages in between full on (3.3 Volts) and off (0 Volts) by changing the portion of the time the signal spends on versus the time that the signal spends off. The duration of “on time” is called the pulse width. To get varying analog values, you change, or modulate, that pulse width. If you repeat this on-off pattern fast enough with an LED for example, the result is as if the signal is a steady voltage between 0V and 3.3V controlling the brightness of the LED. (See the LED Fading example in the File->Sketchbook->Examples->Analog menu of the 86Duino Coding IDE.)

In the graphic below, the green lines represent a regular time period. This duration or period is the inverse of the PWM frequency. In other words, with 86Duino’s PWM frequency at about 1000Hz, the green lines would measure 1 millisecond each. A call to analogWrite() is on a scale of 0 – 255, such that analogWrite(255) requests a 100% duty cycle (always on), and analogWrite(127) is a 50% duty cycle (on half the time) for example.

Analog Input Pins

The 86Duino contains an built-in multi-channel analog-to-digital (A/D) converter (based on the successive approximation principle), which can convert a continuous physical quantity (i.e., voltage) to a digital number, and is mostly used to read analog sensors.

The A/D converter has 11-bit resolution with 100ksps sampling rate, and allows the maximum input voltage of 3.3V. One should always avoid to input a voltage > 3.3V on any analog pin; otherwise, the whole A/D converter will behave strangely and even be destroyed. A call to analogRead() can get the digital number that the A/D converter returns to represents the physical quantity’s amplitude about the calling time.

See also

pinMode()
digitalWrite()
digitalRead()
analogWrite()
analogRead()


Getting-Started Home

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.