set pin to low with a delay when another pin high

Hi, I first want to apologize, because I am sure that question has been brought up before, but I could not dig it out. I'm trying to implement a 2 wire character LCD(hitachi compatible) control with a shift register, but the shift register IC I'm using (74HC164) has to be reset after each shift out operation to the LCD. There is a MR (master reset) pin, that when set to low resets asynchronously all bits. In order to do what I need, I have to set the pin to low with a short delay, after I set another pin to high. So I am asking all the electronic gurus around here - how can I do that (the simplest way)? The delay should be at most 10 microseconds. Thank you in advance!

I think what you're looking for is delayMicroseconds(us) http://arduino.cc/en/Reference/DelayMicroseconds

int PinA = 8;                 // digital pin 8
int PinB = 9;                 // digital pin 9

void setup()
{
  pinMode(PinA, OUTPUT);      // sets the digital pin as output
  pinMode(PinB, OUTPUT);      // sets the digital pin as output
}

void loop()
{
  digitalWrite(PinA, HIGH);   // sets the pin HIGH
  digitalWrite(PinB, LOW);    // sets the pin LOW
  delayMicroseconds(10);     // pauses for 10 microseconds      
  //continue on
}

Good luck!

By 'two wire' am I correct in assuming you mean "Two Wire Interface (TWI)" also known as I2C?

If so, the Decimilia and Duemilanove both have the I2C protocol built in if they are using either the ATMega168 or ATMega328 chip.

Link to the library: http://arduino.cc/en/Reference/Wire

No need for the shift reg.. just connect Analog pins 4&5.

I caused confusion by trying to explain using words :). Here is a link to such implementation: http://www.rentron.com/Myke1.htm He's using a PIC and a little bit different shift register, but this is the idea, and my troubles come from the specifics of the SR I'm using. Here is it drawn: http://www.scienceprog.com/interfacing-lcd-to-atmega-using-two-wires/ The thing is the guy mentions that this is just an idea, and probably he did not try it.

Myke Predko.. haven't seen that name in a while.

Another great solution (albeit off the shelf): melabs Serial LCD Controller Module http://www.melabs.com/products/displays.htm

3rd product down. One wire to LCD.

I've debugged the communication with the shift register and it loads fine. I've debugged the AND gate for enabling the data to the LCD, and the data lines. I have still not dug into what exactly shiftOut does, but I am only interested in if when executing: shiftOut( _data_pin, _clck_pin, MSBFIRST, B00000000 ); something sets the _data_pin to HIGH. Now I am getting strange results - sometimes (very rarely) text is displayed fine (for example "77777777"). I've searched for bit patterns that allow for a error that in this specific case leads to bits shifting in such a way that the data fed to the LCD seems like the real data. Sometimes the LCD just displays bars and no visible text (I have contrast control and I adjust it accordingly). I am guessing that some communication error might feed the LCD with wrong commands. I did not find such information, but I think there is no permanent memory on those displays - no EEPROM or sth. like that? It occurred to me that it might have happened that during wrong communication I might've programmed it incorrectly, but that does not seem to be the case. Also there is the problem with the standard LiquidCrystal library that does not take into consideration timings when initializing a display, which has to be accounted for.

(74HC164) has to be reset after each shift out operation to the LCD

This is not a requirement of the shift register. If you want to keep a pin high then keep it high in the next 8 bits you shift in and the shift / load will clock it in without having it changed.

Yes most multi line LCD displays do not have contiguous memory locations.

Yes most LCD implementation ions do no read the busy bit before sending data relying on time delays.

Thank you for the answers. I have used some wording incorrectly - the shift register IC does not have to be reset for new values to be clocked in. I just would like to use the hardware reset pin if possible. It has to be set low for the SR to be cleared. I guess that at some point while clocking in new values because of the specifics of the AND gate and probably wiring/program issues some strange values are loaded into the LCD. That was the problem before I realized that for this circuit to work I have to put the enable bit last. Before that it was even stranger. So the question really was what is the simplest circuit that hold a value high if another value is low, but when that last one value becomes high the circuit becomes low with a short delay. I understand how to do part of that with a transistor, but don't know how to do the delay.

I just would like to use the hardware reset pin if possible.

I don't understand why you WANT to use this pin when it is the totally wrong thing to do.

was what is the simplest circuit that hold a value high if another value is low

You don't need any circuit it is just a matter of software. Suppose you want to have pin 4 from the shift register put high, then pin 0 put high, then a delay, next pin 0 put low and finally all the pins low, all you need to do is:- 1. Send the value 0x10 to the shift register. This sets pin 4 high. 2. Send the value 0x11 to the shift register. This sets pin 0 high and keeps pin 4 high. 3. Delay for as long as you want. 4. Send the value 0x10 to the shift register. This sets pin 0 low and keeps pin 4 high. 5. Send the value 0x00 to the shift register. This sets pin 4 and zero low.

Thanks for the suggestions. The idea to use the pin was that I found out that if I don't clear the shift register with a zero byte but just shift in a new byte it might happen that partial and thus wrong data would be fed to the LCD - the AND gate will be true, because of a bit being shifted out (belonging to the former byte). So there are two factors for me to want to explore the reset pin idea: - I might have a situation like the mentioned. As I said before I was not sure what exactly does the shiftOut function. Or I have some signals wrong. - The speed to do shifting of an empty byte might be slower than to reset the SR. I understand that to time a circuit with discrete components is orders of magnitude more complicated than to do timing in the micro processor.

So the problem was that I still interpret too freely the schematics. If it says zener I use the first zener that is in my parts bin. It turns that the reverse voltage of the zener I was using was just enough for the signal to float (be either 0 or 1). I swapped the zener for a simple 1n4004 and it worked. I know I cannot get a gigahertz switching with this diode, but it's ok for now. Here is the schematics once again: http://www.scienceprog.com/interfacing-lcd-to-atmega-using-two-wires/