Why can I only send 28 holding registers over modbus?

The library you use has a buffer for the response message of size 64 bytes. That includes the data and the message header as well as the CRC.

But anyway thanks, it must be this. I will try looking for a different library with a larger buffer.

What about simply increasing the buffer size if you really need to transfer all values in one message.