Software access to GPIOs
eZ80 ports are described in the
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
Summary of Contents for AgonLight2
Page 1: ...AgonLight2 User Manual Rev 1 8 October 2023 olimex com 1...
Page 3: ...INTRODUCTION 3...
Page 8: ...HARDWARE 8...
Page 11: ......
Page 12: ......
Page 13: ......
Page 14: ......
Page 18: ...Access bus connector This is I2C and power supply with 3 3V levels 18...
Page 21: ...SOFTWARE 21...
Page 29: ...Software access to I2C TBD 29...
Page 30: ...Software access to SPI TBD 30...
Page 31: ...Software access to VPU TBD 31...