Xenobius
Member level 5

Hi, I am trying to control an LCD using a shift register. I am using the very successful arduino LiquidCrystal library which is tried and tested but am trying to modify the only function which differs. Instead of writing bytes directly to pins (like in the original function below) I am trying to output using a shift register (also as below). Its good to point out that I do not have d0 to d7 pins but instead a shift register connected to the LCD where d0 = bit 1, d1 = bit 2, .... d7 = bit 8
As for rs, en and rw they are connected directly to the microcontroller so this is straight forward. LCD datasheet here
so technically, if I want to write the value binary 00001011 to d0-d7, using the shift register I should be able to shift out the value decimal 11 however this is not working. Can anyone assist please?
The original code as per github (the very last function scroll all the way down)
and my modified code
Thanks
As for rs, en and rw they are connected directly to the microcontroller so this is straight forward. LCD datasheet here
so technically, if I want to write the value binary 00001011 to d0-d7, using the shift register I should be able to shift out the value decimal 11 however this is not working. Can anyone assist please?
The original code as per github (the very last function scroll all the way down)
Code:
void LiquidCrystal::write8bits(uint8_t value) {
for (int i = 0; i < 8; i++) {
digitalWrite(_data_pins[i], (value >> i) & 0x01);
}
pulseEnable();
}
and my modified code
Code:
void LiquidCrystal::write8bits(uint8_t value) {
digitalWrite(_latch, LOW);
shiftOut(_data, _clock, LSBFIRST, value);
digitalWrite(_latch, HIGH);
pulseEnable();
}
Thanks