Interfacing a microcontroller to industrial systems, which often operate on 24 volt signals, can be a challenge. From EDN, Microcontroller Interfaces to 24V systems, provides wide-range bullet-proof I/O. It uses old-school MC1489 quad RS232 interface chips and will handle a wide input range of up to 30v. Unlike voltage divider inputs or optically-coupled signals, it handles a wide input range without any adjustments being required. Outputs are handled by ULN2803 peripheral driver chips.
Note: this has been posted previously in response to a forum question. I'm reposting it here so that it can easily be found in the future.
Note: this has been posted previously in response to a forum question. I'm reposting it here so that it can easily be found in the future.