check connection
I am assuming your 40 has the Yanmar 4JHE, I would first suggest you check all the connections on your wiring harness. My harness has connections behind the tach, behind the master bed and at the engine. If all of your connections are clean and connected. Check the sending unit which is on the port side of the flywheel housing, make sure the connections there are clean and tight (I had problems at that connection before) if all connections are tight you can pull the sending unit out and check it with a meter. (It tells how to do this in the Yanmar Service Manual). The sending unit counts the actual revolutions of the flywheel. If all of the above checks out ok you may have a problem in the tach itself. I had to replace the tach on my 1988 40 last year. Good luck