Copyright © Vecow Co., Ltd. All Rights Reserved. SPC-2000 Series Ultra-compact Embedded System User
Manual
58
APPENDIX A: ISOLATED DIO GUIDE
A
ppendix A:
ISOLATED DIO GUIDE
A.
SIO Pin Definition
IO Pin
GPIO 77~74
GPIO 73~70
Base Adr.
0xA06[7:4]
0xA06[3:0]
Usage
Input
Output
B.
Function Description
The SPC-2000 offers a 8-bit DIO (4-DI / 4-DO) DB9 connector.
Each bit of DI and DO equipped with a photo-coupler for isolated protection.
All IO pins are fix by Hardware design that cannot change in/out direction in runtime process.
The definition is shown below:
C.
Register Allocation
#define LOGIC_DEVICE_ADDRESS 0x07
#define LOGIC_DEVICE_GPIO
0x07
#define LOGIC_DEVICE_WDT 0x07
( Use same Group Table)
#define GPIO7_IO_Dir
0xCE
D.
Set I/O Direction
Setdata
(
GPIO7_IO_Dir
,
0x0F
);
Low level [0] : The I/O pin set as input.
High level [1] : The I/O pin set as output.
E.
Output Data
The data format is four bit , please mask upper four bit to avoid some run-time error.
byte testdata;
outport
(
DIO_Port
,
0x0F&testdata
);
F.
Input Data
You need shift right four bit to get input value.
inportb(DIO_Port)>>4;