[Device] Input Output Interface - Bin Systems

All discussions related to the DCPU and in game hardware (equipment, vehicles)

[Device] Input Output Interface - Bin Systems

Postby DaveSparhawk » Sun Mar 16, 2014 7:18 am

Input Output Interface
Version: 0.1

The Input Output Interface or IOI is a simple breakout for turning systems on off or reading state of some binary sensors. this system will not dim lights or read power consumption for such functionality you would need a Advantage IOI currently bring tested on animals. This unit is restricted to 32 binary channels.

- Device Class : TBA (Digital Input and Output controller)
- Device Builder : 0x931A 5C7F (Bin Systems)
- Device ID : 0x0001
- Device Rev : 0x001a

IOREG 'Input Output Buffer
DDREG 'Data Direction Register
IIREG 'Interrupt Inhibit Register
Changing the mapped command register will have results dependent on the value that is set:

A Register:
disables the generation of all interrupts that are caused by digital inputs (interrupts are lost, state changes will not be reported when enabled)

enables the generation of interrupts

- 0x0002: GET_STATUS
Requests a 16 bit Status/Error code from device that is stored in the A register.

- 0x0003: RESET_DEVICE
IOREG=0x0, DDREG=0x0, IIREG=0x0
OOREG to off,Interrupts to Inhibit and DIRECTION register to INPUT

- 0x0004: INITILISE
Set the IOREG,DDREG,IIREG all in one instruction, but uses A,B,C registers

- 0x0005: SET_IOREG
IOREG=A sets the output state of pins. if pins are set to Input the value stored has no effect.

- 0x0006: GET_IOREG
A=IOREG gets the input register, only inputs selected in DDREG are dependent on connected binary devices

- 0x0007 SET_DDREG
DDREG=A Sets the direction register, 1 is for an output a 0 is for an input

Use this to enable interrupts for a change on an input pin. a Zero(default) will mean the interupt will not be created(and not kept for later)
Interrupts will be one of the following:
* Rising Edge (Binary device sends a high)
* Falling edge (Binary Device Sends a low)

User usage:

### Example code:

'X Register holds pointer to external hardware Registers EG: 0X113000
'a simple light and switch example:

'init code:
SET [X+0x08],0x0000 'DEVICE_DISABLE

SET [X+0x08],0x0003 'RESET_DEVICE

SET A,0x0001 'binary device zero is an output
SET [X+0x08],0x0007 'SET_DDREG

SET A,0x0002 'binary device one is an input generating an interrupt


SET [X+0x08],0x0001 'DEVICE_ENABLE

'main execution loop

'interrupt check routine

'conditional check for low to high transition:
AND A,0x0002

'if A is Zero:
XOR A,0x0001

'end of interrupt routine
Posts: 28
Joined: Sat Mar 08, 2014 11:14 am

Return to Hardware

Who is online

Users browsing this forum: Google [Bot] and 1 guest