Commit 57dd9237 authored by Tristan Gingold's avatar Tristan Gingold

Add programm with the dio board.

parent cc8ba521
#include <stdint.h>
#include "plc_urv_regs.h"
/* Ch0: input (bit 1)
ch1: -- (bit 0).
ch2: --
ch3: output (bit 5, en 8) */
#define SLOT pins_5
#define OEN ((1 << 6) | (1 << 7) | (0 << 8) | (0 << 9) | (0 << 11))
void
init (void)
{
volatile struct plc_urv_regs *regs =
(volatile struct plc_urv_regs *)0x00000;
regs->relays.SLOT = OEN;
}
void
main (void)
{
volatile struct plc_urv_regs *regs =
(volatile struct plc_urv_regs *)0x00000;
while (1) {
unsigned v = regs->loops.SLOT;
v = !! (v & 0x7);
// v = (v & 2) >> 1;
// v |= regs->loops.pins_4 & 1;
regs->relays.SLOT = (v << 5) | 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