4.
Sample Code in C language
Control of GP00 and GP01
#define AddrPort 0x2E
#define DataPort 0x2F
<Enter the Extended Function Mode>
WriteByte(AddrPort, 0x87)
WriteByte(AddrPort, 0x87) //Must write twice to entering Extended mode
< Select Logic Device >
WriteByte(AddrPort, 0x07)
WriteByte(DataPort, 0x06) // Select logic device 06h
< Multi Function Selection >
WriteByte(AddrPort, 0x2A)
WriteByte(DataPort, ReadByte(DataPort) | 0x01))
//Set (bit 0/1) = (1) to select Function is GPIO.
<Output Mode Selection>//Set GP00/01 to output Mode
WriteByte(AddrPort, 0xF0) // Select configuration register F0h
WriteByte(DataPort, (ReadByte(DataPort) | 0x03))
//Set (bit 0/1) = (1) to select GP 00/01 as Output mode.
<Output Value>
WriteByte(AddrPort, 0xF1) // Select configuration register F1h
WriteByte(DataPort, Value) //Set bit n = (0/1) to output as Low or High.
<Leave the Extended Function Mode>
WriteByte(AddrPort, 0xAA)
- 98 -
Need help?
Do you have a question about the POS-8017F Series and is the answer not in the manual?