[fpc-devel] FPC micro controller
patrolliekaptein at gmail.com
Wed Jul 29 20:28:44 CEST 2009
But if I define the 'nibble' data types myself (or use the bit packed data
types provided by a 'system' unit for the particular chip), they would stay
Did I understand correct of how to use a bit packed structure in code?
In my original question I wondered if FPC would provide a bit data type in
the future of MCU compiler development. Smaller chips are bit accessible. If
I may explain by example of hypotheses and use a code example:
It would be nice to see:
TPortAStruct = bitpacked record
Low = 0..7;
High = 8..15;
PortA : ^TPortAStruct;
MyLatch : ^Bit; //the future bit data type being 1 bit wide
MyRedLED : ^Bit;
//and now to use
//set up the adresses
PortA := $0A01; //the supposed address for port A on this chip
MyLatch := PortA.Low; //the hypotheses: MyLatch is on PortA, low byte,
MyRedLED := PortA.High; //My red LED is on PortB, high byte, bit 0
//now only use the bits in the registers
MyLatch^ := True;
MyRedLED^ := True;
//now use the whole register
PortA^ := 0;
On Wed, Jul 29, 2009 at 5:41 PM, Jonas Maebe <jonas.maebe at elis.ugent.be>wrote:
> On 29 Jul 2009, at 18:47, Daniël Mantione wrote:
> Op Wed, 29 Jul 2009, schreef Desmond Coertzen:
>> This is my first question / suggestion: With byte sized variables being
>>> smallest accessible variable in the PC architecture, will we see a
>>> extension to provide bit accessible variables for the micro controllers?
>> Do you mean bitpacking?
>> type nibbles=bitpacked record
> This is not usable for accessing particular bits of microcontroller
> registers, because the internal format of a bitpacked record is undefined
> and can change at any time for any reason.
> fpc-devel maillist - fpc-devel at lists.freepascal.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-devel