How to dynamically re-allocate serial buffer sizes?

I am using an RCM4100 or RCM4200 processor. For port D, for example, I know I must define the DINBUFSIZE AND DOUTBUFSIZE parameters, to say, 63 bytes. That works fine if I am using defines to alter the way the program compiles, but how do I dynamically change those values based on a DIP switch setting of my communications protocol? For example, what if I want 255 bytes for Modbus or 511 bytes for DF1 as set by a DIP switch input? Can I use malloc to change these and if so how?

No, that’s a compile-time option only. You’ll have to use 511 bytes in all cases.

I was afraid that was the answer. I’m going to have to investigate why we were using 511 bytes for some protocols and less for others. I did not originally write this program. We might be able to get away with much less, but that is another issue. Thanks for the response.

I would be surprised if the larger buffer caused problems for the protocol that was using a smaller buffer.