[fpc-devel] FPC micro controller

Desmond Coertzen 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
that way?

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[3]; //the hypotheses: MyLatch is on PortA, low byte,
bit 3
  MyRedLED := PortA.High[0]; //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
>>> the
>>> smallest accessible variable in the PC architecture, will we see a
>>> language
>>> extension to provide bit accessible variables for the micro controllers?
>> Do you mean bitpacking?
>> type  nibbles=bitpacked record
>>       low_nibble=0..15;
>>       high_nibble=0..15;
>>     end;
> 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.
> Jonas_______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20090729/bc589329/attachment.html>

More information about the fpc-devel mailing list