SPLat Logo

Understanding EC1 digital inputs

NOTICE: SPLat Controls has moved. We are now at 1/85 Brunel Rd, Seaford, 3198. map

In this EasyStep you will discover the basic electrical characteristics of the EC1's digital inputs. This is a highly condensed extract from the official data sheet of the STM32F372CC chip - about 5 pages' worth of it. This applies to all digital inputs except input 0, the push button input (separate heading below).

Expert summary

Close

Got the right firmware?

Some early EC1's got shipped with firmware that has Active high inputs rather than active low. To make sure you have the right firmware, please download and install the current firmware in your EC1. Download page. This will ensure your board behaves as advertised on this page.

Close

A digital input is a pin that senses the on/off state of something connected to it. How this is done can vary greatly. In the case of the EC1 the inputs are voltage sensitive. The EC1's processor senses the voltage applied between 0V (common, power supply negative) and the input pin, and based on that decides if it is "high" or "low" A high voltage is anything greater than 2.43V. A low voltage is anything less than 0.94V. Anything in between is indeterminate. Voltages less than 0V or greater than the processor chip's 3.3V supply voltage can damage the chip (but see the section "5V tolerant inputs" below).

A low input voltage is considered to be ON, and a high voltage is considered to be OFF. This is the opposite of the outputs. We made it this way because it is more likely to be compatible with the most common sensor devices. In this context ON and OFF correspond to True and False results from an Input instruction.

ON/OFF, High/Low, True/False, 1/0 — what gives???

Confused about all the different names for logic levels? I don't blame you!

There are several different terminologies used to describe the two states that a Boolean or logical variable can be in. Traditionally, in SPLat, we have tended to use ON and OFF to describe the two states of input and output pins, because these relate most closely to the physically world of sensors, switches, relays, lights etc. However, if you start probing a pin with a multimeter or oscilloscope, the terms "high" and "low" (indicating relative voltages) are useful.

Inside the processor other terms can also be used, such as True and False, or 1 and 0. Which term makes most sense depends on the context. It would sound a bit daft to say "the light is true" (except possibly in some sort of spiritual context) or that the motor is at low.

So what does it all mean?

Internally the EC1 represents these things by bits in memory that are either 0 or 1. These follow the rules of Boolean algebra when you perform operations like AND, OR etc. Sometimes whole bytes (8 bits) may be involved, in which case the "pure" values are all-zeroes or all-ones.

Internally these values may also be referred to as True (=1) or False (=0). A few SPLat instructions embody this in their mnemonics (key words), like for example GoIfT ("Go If True").

It gets more interesting when you start exchanging these internal, abstract entities with real-world inputs and outputs. This is where ON and OFF become important.

In SPLat, we always make it so that a True or 1 internal value sent to an output using an Output instruction, will turn that output ON. And we always make it so when you read an input using say an Input instruction, the resulting internal value will be True or 1 if the physical input is in its ON state.

That only leaves us with the matter of defining what ON and OFF mean in electrical terms. In the EC1, for subtle technical reasons, we decided that on outputs the ON state is the "high" voltage level, which for the chip we use is 3.3V positive relative to the 0V or common terminal. For equally subtle reasons we decided that on inputs it is the other way around: A low voltage (close to 0V) on an input is the ON state. That may sound crazy and inconsistent, but of the 4 possible choices we had it is the one that most of the time will provide the best match for any circuits you add externally to the EC1.

Sometimes you may hear the terms "active high" and "active low". These generally are code for the content of the previous paragraph: EC1 outputs are active high and its inputs are active low.

You may also encounter the terms positive logic and negative logic. They are more applicable to old fashioned networks of low level logic chips, where the designer could reduce the cost by alternating between positive logic (high voltage = true) and negative logic (high voltage = false) by clever application of DeMorgan's laws

Close

Internal to the processor chip each input pin has a 40KΩ resistor between the input pin and the +3.3V supply. We call this a pull-up resistor, because it pulls the input pin up to 3.3V if there is nothing else connected. This has a few consequences:

The sketch shows two possible input sources, a switch and an NPN transistor. The 40KΩ resistor is inside the processor chip.

Confused about "0V", "common", "gnd"? Click here to see some common terminology.

If your background is not in the electronics field, we may confuse you a bit with the way we refer to power supply pins, grounds, "common" terminals etc. In electronics we generally quote all voltages in relation to an assumed common or reference terminal. That common terminal is often called "ground", "gnd" or "circuit ground". It may or may not actually be tied to a physical ground point, for instance mains power supply earth.

In SPLat boards we usually label the "ground" terminal "0V". On boards that are powered off an external DC power supply (which is most off-the-shelf boards), 0V is the terminal connected to the negative terminal of the power supply. Measured relative to that pin, therefore, the positive power supply pin will be 24V (or 12V or whatever the supply voltage is) positive. We then say "we have a +12V supply". All boards contain a voltage regulator chip to feed the microprocessor and/or other logic chips. In the EC1 this chip generates 3.3V nominal (many other boards use 5V). Its output voltage is said to be +3.3V, again measured relative to the 0V terminal.

Similarly, all input and output voltages are also measured relative to the 0V terminal, and will in virtually all cases be positive voltages. For example, on most SPLat models the input voltage threshold for digital inputs, and analog input and output voltages, are measured relative to 0V.

The push button input

Input 0, which is the onboard push button, is also available on pin 30 of the EC1 board. You can use this input in your application, providing you observe the following constraints:

  1. The pin has a 10KΩ resistor to 0V, NOT 40KΩ to +3.3V;
  2. It requires a "high" voltage (+3.3V) for the ON state (opposite of all the other digital inputs);
  3. If it is held high at power-on or hard reset, the chip will go into reFlash mode and not run your SPLat program. It will be expecting a firmware update instead. See Upgrading the firmware in your EC1

5V tolerant inputs

Many of the pins on the EC1 are "5V tolerant". That means that when the pin is used as an input, it can be connected to +5V. The EasyStep on the EC1 I/O map specifies which pins are 5V tolerant.

Some interesting ways to blow up your EC1

If you want to blow up your EC1, and void the warranty, here are some things you can do to the inputs: