5v clock signal to 24v
If you really MUST use a 24V relay, or any relay really, you should use either an NPN or N-MOSFET driver like this..







simulate this circuit &ndash; Schematic created using CircuitLab

But that really is not the best way to clock a counter. Relays bounce and can cause your counter to miscount. I am assuming you are using a relay for reasons of isolation. As such using an opto-coupler would be better.







simulate this circuit