Sensor declarations

The SENSORS section of the declarations lists all the inputs received from hardware, such as:

Sensors:
sen1, sen2, sen3

Sensor inputs are associated with the hardware connections in the following manner:

The first sensor name (sen1 in the above example) is taken from the first bit (bit 0) of the input module closest to the stack header (RPI or QTU).

Subsequent bits of that module are assigned to subsequent names from the list (sen2, sen3 etc). This is regardless of how many bits the module uses.

When the first module is exhausted, the next is used.

This means that if you add a module to the stack (normally at the end furthest from the stack header) its inputs are accessed by adding names to the end of the list.

If you have multiple stacks on one interface (such as using RS485) then assigning inputs continues after exhausting the first stack with the first bit of the first module of the second stack, and so on.

If you have multiple interfaces (serial ports) these follow on in the order they appear in the Network Configuration window.

Spare inputs:

You can skip input pins in either of two ways:

Some inputs are positive logic (active when high) and some are negative logic (active when low). You can invert the sense of selected inputs to achieve consistency. This is done by suffixing the name with a tilde '~', such as in:

Sensors:
sen1, sen2~, sen3

Perhaps sen1 and sen3 are LDRs (the input goes high when the sensor is obscured and its resistance goes high), but sen2 is a reed relay (the input goes low when the magnet turn on the relay, thus shorting the input to ground).

This inverts the second input (bit1, or sen2) from the hardware before assigning it to the input variable sen2.

The arrangement of inputs in the 'Sensors' window can be controlled using the GROUP statement.

Back to declarations page

Last updated 15 Sep 2007

© Howard Amos 2005-2007