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?<br><br>Did I understand correct of how to use a bit packed structure in code?<br>
<br>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:<br>
<br>It would be nice to see:<br><br>type<br> TPortAStruct = bitpacked record<br> Low = 0..7;<br> High = 8..15;<br> end;<br> <br>var<br> PortA : ^TPortAStruct;<br> MyLatch : ^Bit; //the future bit data type being 1 bit wide<br>
MyRedLED : ^Bit;<br><br>//and now to use<br><br>begin<br> //set up the adresses<br> PortA := $0A01; //the supposed address for port A on this chip<br> MyLatch := PortA.Low[3]; //the hypotheses: MyLatch is on PortA, low byte, bit 3<br>
MyRedLED := PortA.High[0]; //My red LED is on PortB, high byte, bit 0<br> //now only use the bits in the registers<br> MyLatch^ := True;<br> MyRedLED^ := True;<br> //now use the whole register<br> PortA^ := 0;<br>end.<br>
<br><div class="gmail_quote">On Wed, Jul 29, 2009 at 5:41 PM, Jonas Maebe <span dir="ltr"><<a href="mailto:jonas.maebe@elis.ugent.be">jonas.maebe@elis.ugent.be</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5"><br>
On 29 Jul 2009, at 18:47, Daniël Mantione wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Op Wed, 29 Jul 2009, schreef Desmond Coertzen:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
This is my first question / suggestion: With byte sized variables being the<br>
smallest accessible variable in the PC architecture, will we see a language<br>
extension to provide bit accessible variables for the micro controllers?<br>
</blockquote>
<br>
Do you mean bitpacking?<br>
<br>
type nibbles=bitpacked record<br>
low_nibble=0..15;<br>
high_nibble=0..15;<br>
end;<br>
</blockquote>
<br></div></div>
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.<br><font color="#888888">
<br>
<br>
Jonas_______________________________________________</font><div><div></div><div class="h5"><br>
fpc-devel maillist - <a href="mailto:fpc-devel@lists.freepascal.org" target="_blank">fpc-devel@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-devel" target="_blank">http://lists.freepascal.org/mailman/listinfo/fpc-devel</a><br>
</div></div></blockquote></div><br>