Commit fdc2644b authored by Tristan Gingold's avatar Tristan Gingold

plc_dio: sense all inputs.

parent 57dd9237
#include <stdint.h>
#include "plc_urv_regs.h"
/* Ch0: input (bit 1)
ch1: -- (bit 0).
ch2: --
ch3: output (bit 5, en 8) */
/* Ch0: input (bit 1, en 6)
ch1: -- (bit 0, en 7).
ch2: -- (bit 2, en 9)
ch3: output (bit 5, en 8)
ch4: output (bit 4, en 11) */
#define SLOT pins_5
#define OEN ((1 << 6) | (1 << 7) | (0 << 8) | (0 << 9) | (0 << 11))
// ch0 ch1 ch3 ch2 ch4
#define OEN ((1 << 6) | (1 << 7) | (1 << 8) | (1 << 9) | (0 << 11))
void
init (void)
......@@ -28,10 +30,10 @@ main (void)
while (1) {
unsigned v = regs->loops.SLOT;
v = !! (v & 0x7);
v = !! (v & 0x27);
// v = (v & 2) >> 1;
// v |= regs->loops.pins_4 & 1;
regs->relays.SLOT = (v << 5) | OEN;
regs->relays.SLOT = (v << 4) | OEN;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment