PDA

View Full Version : ALLOT and 'buf_siz 4 +'


sengle
02-23-08, 11:28 PM
When creating buffers for serial i/o, this is standard practice.

HERE 80 4 + ALLOT CONSTANT SCIBUF1_A

However, is the '4 +' only required for serial i/o buffers, or for any memory allocation using ALLOT? I am creating arrays via this method to store values read in from the ADCs and wonder if the '4 +' is required for those, or if...

HERE 5 ALLOT CONSTANT ADC_FRONT

...is sufficient to store 5 ADC reads.

Thanks!

Steve

RMDumse
02-24-08, 10:10 AM
When you allot a buffer, you expect a certain size. So if you were getting 80 character strings, you might allot 82 (to pick up the CR and LF) 4 + (the extra four are for pointers required by the interrupts).

So yes, the extra 4 + is unique to allotting serial buffers, and is not necessary for regular storage. Your example of allotting 5 locations for 5 readings is fine.