Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
DIOT WIC Gateware
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
DIOT WIC Gateware
Commits
fdc2644b
Commit
fdc2644b
authored
May 04, 2020
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plc_dio: sense all inputs.
parent
57dd9237
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
plc_dio.c
sw/plc_urv/plc_dio.c
+9
-7
No files found.
sw/plc_urv/plc_dio.c
View file @
fdc2644b
#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
&
0x
2
7
);
// v = (v & 2) >> 1;
// v |= regs->loops.pins_4 & 1;
regs
->
relays
.
SLOT
=
(
v
<<
5
)
|
OEN
;
regs
->
relays
.
SLOT
=
(
v
<<
4
)
|
OEN
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment