EXTIO[0] - EXTIO[7]


Up to 64 digital IO pins can be controlled using PCF8574 I2C port expanders. Output and input can be set per pin. Up to 8 chips can be used in parallel, and the I2C addresses can be set in the Setup/Peripheral/I2C menu according to the A0-A2 pins of the IC. PCF8574: 20H-27H, PCF8574A: 38H-3FH. The addresses of the devices on the bus are displayed in the serial terminal during boot. The IC IO pins are open drain outputs with built-in pull-up resistors. When programmed as a low output, Vcc should not be connected to it!!! Default: all pins are inputs.

PCF8574 Port

EXTIO[0]LLHHIIXX
P0: output LOW
P1: output LOW
P2: output HIGH
P3: output HIGH
P4: input
P5: input
P6: no change
P7: no change

EXTIO[0]@
Sends the entire port state to STDOUT regardless of data direction.
EXTIO[0]IN@
Sends the state of the last changed input(s).

EXTIO[0]CC:STR[0]@=%EXTIO[0];LED(FLASH)
Executes the command when the state of any pin changes.
EXTIO[0]CI:EXTIO[0]IN@;LED(FLASH)
Executes the command when the state of any input pin changes.

EXTIO[0-7]IIIIIIII
All pins of all ICs are inputs. Other commands can also be used in this form.
EXTIO[0-7]@
Sends the current state of the pins to STDOUT.

PCF8574 Pin

EXTIO[0](0)L
Sets P0 pin to LOW output.
EXTIO[0](0)H
Sets P0 pin to HIGH output.
EXTIO[0](0)I
Inverts P0 pin.
EXTIO[0](1)IN
Sets P1 pin to input.

EXTIO[0](1)@
Sends the state of the pin to STDOUT.

EXTIO[0](1)CL:STD@LOW;LED(FLASH)
Executes the command when the pin changes from high to low.
EXTIO[0](1)CH:STD@HIGH;LED(FLASH)
Executes the command when the pin changes from low to high.



Példák

Nyolc csatornás bemenet online.
EXTIO[0]IIIIIIII|
EXTIO[0]CC:EXTIO[0]@

<html> <body> <H1>EXTIO[0] INPUT</H1><br> <center> <span id="ins" style="pointer-events:none"></span> </center> <script type="text/javascript" src="tools.js"></script> <script> startWS(0); var i; for (i = 0; i < 8; i++) document.getElementById("ins").innerHTML += "<label>P" + i + "</label><input type='checkbox' style='width:4em;height:4em;' id='in" + i + "'/>"; function onOpen() { sendWS("EXTIO[0]@"); } function onMessage(msg) { for (i = 0; i < 8; i++) { if (msg.substring(i, i+1) === "H") document.getElementById("in" + i).checked = false; if (msg.substring(i, i+1) === "L") document.getElementById("in" + i).checked = true; } } </script> </body> </html>
Nyolc csatornás kimenet online.
EXTIO[0]HHHHHHHH|
EXTIO[0]CC:EXTIO[0]@

<html> <body> <H1>EXTIO[0] OUTPUT</H1><br> <center> <span id="ins"></span> </center> <script type="text/javascript" src="tools.js"></script> <script> startWS(3); var i; var s; for (i = 0; i < 8; i++) document.getElementById("ins").innerHTML += "<label>P" + i + "</label><input type='checkbox' onclick='send(this)' style='width:4em;height:4em;' id='in" + i + "'/>"; function onOpen() { sendWS("EXTIO[0]@"); } function onMessage(msg) { for (i = 0; i < 8; i++) { if (msg.substring(i, i+1) === "H") document.getElementById("in" + i).checked = false; if (msg.substring(i, i+1) === "L") document.getElementById("in" + i).checked = true; } } function send(pin) { if (pin.checked === true) { s = ")L"; } else { s = ")H"; } sendWS("EXTIO[0](" + pin.id.substring(2, 3) + s); } </script> </body> </html>