EasyManua.ls Logo

OLIMEX AgonLight2 - Software Control of GPIOS

OLIMEX AgonLight2
32 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Software access to GPIOs
eZ80 ports are described in the eZ80-specification.
Port direction register set if the port is INPUT or OUTPUT. Upon RESET all GPIOs are set as Inputs.
Direction registers are 8 bit and each bit corresponds to port signal. If 1 is written on the corresponding port
will be set as Input if 0 as Output.
Port B data direction register is at address: 009Bh = 153 decimal
Port C data direction register is at address: 009Fh = 159 decimal
Port D data direction register is at address: 00A3h = 163 decimal
If we read the Port C direction register we can PRINT GET(159) and it should return 255
If we want to set GPIO_PC0 as output we should write 0 in bit 0 with the command PUT 159,254.
Data registers are 8 bit and each bit corresponds to port signal. If 1 is written on the corresponding port will
be set 3.3V if 0 is written 0V will be set.
Port B data register is at address: 009Ah = 152 decimal
Port C data register is at address: 009Eh = 158 decimal
Port D data register is at address: 00A2h = 162 decimal
If we read data register with GET() command, for instance PRINT GET(158) it will return the state of Port
C.
We can write the data register with PUT command, for instance PUT 158,1 will set GPIO_PC0 to +3.3V and
PUT 158,0 will set it to 0V.
28

Related product manuals