Library for Winstar Display Controller WS0010
I. Algorithm for 4-bit mode via PCF8574 in short.
- Copy command byte to var1, shift var1 4 times to the right (>>)
- Write var1 to I2C bus
- Set bit 6 (EN) in var1
- Write var1 to I2C bus
- Clear bit 6 (EN) in var1
- Write var1 to I2C bus
- Copy command byte to var1, clear high nibble of var1
- Write var1 to I2C bus
- Set bit 6 (EN) in var1
- Write var1 to I2C bus
- Clear bit 6 (EN) in var1
- Write var1 to I2C bus
- Zeroize var1
- Set bit 5 (R/W) in var1
- Write var1 to I2C bus
- Set bit 6 (EN) in var1
- Write var1 to I2C bus
- Read byte from I2C bus into var2
- Clear bit 6 (EN) in var1
- Write var1 to I2C bus
- Shift var2 4 times to the left (<<)
- Set bit 6 (EN) in var1
- Write var1 to I2C bus
- Read byte from I2C bus into var3
- Clear bit 6 (EN) in var1
- Write var1 to I2C bus
- Clear high nibble of var3
- Logically OR var2 and var3, save result to var2
- Test bit 7 (BF, Busy Flag) in var2
- If bit 7 set, sleep WAIT_BF, go to step 13
- If bit 7 cleared, go further
- Zeroize var1
- Write var1 to I2C bus
II. Initialization sequence for 4-bit mode.
- Write 0x0 nibble 5 times
Two lines (bit 3, N=1), 5x8 font size (bit 2, F=0), EN/RU character font table (bits 1 and 0, FT1=1, FT0=0)
- Write high nibble of command byte as 0x2 (DL=0) 2 times
- Write low nibble of command byte as 0xA (N=1, F=0, FT1=1, FT0=0)
- Check BF
- Write high nibble of command byte as 0x0
- Write low nibble of command byte as 0xF (D=1, C=1, B=1)
- Check BF
- Write high nibble of command byte as 0x0
- Write low nibble of command byte as 0x1
- Check BF
- Write high nibble of command byte as 0x0
- Write low nibble of command byte as 0x2
- Check BF
- Write high nibble of command byte as 0x0
- Write low nibble of command byte as 0x6 (I/D=1, S=0)
- Check BF
...