Skip to main content

Reply to "Using an optocoupler to connect insulated rail to input pin of shift register"

Randy,

Exactly my point. There are limitations with both software and hardware debouncing. As I stated previously that is why object oriented programming is important for the Arduino. It allows it to multi task meaning it can run the class functions in the background and keep the loop function running. It allows it to break the boundary of reading line by line. It still is reading line by line, but it reads a line then calls the class and goes to the next line. For example if you have several servos running the program can pretty much move them all at the same time if class is used. Here is a good reference:

https://learn.adafruit.com/mul...uino-part-1/overview

I also agree with not using the delay function. It is best to use a timer to keep the program running.

I'm still thinking about what to use. If we are talking about only a 20 ms debounce time does it make more sense to just use an RC debounce circuit or a times software debounce. Also how does this change the circuit. You will have a 100k resistor on the voltage line into the optocoupler and pull-up resistor on the 5v line, but what else is needed? Some things I have seen on the internet  a diode is added on the input side of the optocoupler. Is a capacitor needed on the output of the optocoupler? 

I'm having a hard time reading the difference between JGL's circuit and Johnh's. Maybe a readable schematic can be posted? JGL has be sold on the 12v ground. I just need to determine the circuit.

Randy I do have a quick question for you. What is your longest run and what type of wire did you use for your RS485 bus?

 

 

OGR Publishing, Inc., 1310 Eastside Centre Ct, Suite 6, Mountain Home, AR 72653
800-980-OGRR (6477)
www.ogaugerr.com

×
×
×
×
×