From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9207ed3696d73010 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-07 09:15:03 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!psinet-eu-nl!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: ada newbie Date: Tue, 7 Aug 2001 12:09:28 -0400 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <9kp3rp$ge5$1@nh.pace.co.uk> References: <9kp053$ro0$1@zeus.orl.lmco.com> NNTP-Posting-Host: 136.170.200.133 X-Trace: nh.pace.co.uk 997200569 16837 136.170.200.133 (7 Aug 2001 16:09:29 GMT) X-Complaints-To: newsmaster@news.cam.pace.co.uk NNTP-Posting-Date: 7 Aug 2001 16:09:29 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:11508 Date: 2001-08-07T16:09:29+00:00 List-Id: You are delving into things (representation) that can be hardware/compiler dependent. >From the ARM 13.5.1 - an example of how to create records wherein you control representation issues. (Read chapter 13 - its really worth it if you want to do low level programming like this.) type Program_Status_Word is record System_Mask : Byte_Mask; Protection_Key : Integer range 0 .. 3; Machine_State : State_Mask; Interrupt_Cause : Interruption_Code; Ilc : Integer range 0 .. 3; Cc : Integer range 0 .. 3; Program_Mask : Mode_Mask; Inst_Address : Address; end record; for Program_Status_Word use record System_Mask at 0*Word range 0 .. 7; Protection_Key at 0*Word range 10 .. 11; -- bits 8,9 unused Machine_State at 0*Word range 12 .. 15; Interrupt_Cause at 0*Word range 16 .. 31; Ilc at 1*Word range 0 .. 1; -- second word Cc at 1*Word range 2 .. 3; Program_Mask at 1*Word range 4 .. 7; Inst_Address at 1*Word range 8 .. 31; end record; for Program_Status_Word'Size use 8*System.Storage_Unit; for Program_Status_Word'Alignment use 8; In general, you can see how the representation clause indicates that you have to specify a byte offset (assuming a byte oriented machine) and a bit range for each of the record elements. You don't need to create "spares" - just don't specify anything occupying those bits. Hope this gets you going - but you *really* should read chapter 13 and look at your compiler documentation and target processor to make sure that you get the clauses correct for *your* specific hardware. You'll discover that in general Ada is very good at letting you control the low level stuff... MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "mop" wrote in message news:9kp053$ro0$1@zeus.orl.lmco.com... > so my data looks like this. In C I could create a structure and go from > there. I'm new to Ada and need help on how to setup the data. I suspect I > could use some sort of a record once I setup the structure in Ada to pass > the data. > > > example data > word bit function remarks > 1 2-0 command logic 001 > 3 mode logic 0 - normal > logic 1 - > diagnostic > 7-4 spare > > etc.etc > 8 7-0 checksum sum of above message bytes > > > i'll be sending data across a serial port and need to change the parity bit > on the fly. from MarkParity to SpaceParity. So I'll send word 1 - default > parity bit MarkParity then change to SpaceParity for the rest of the data. > > help. already wrote fully functional GUI is C but now need to do the same > in Ada and have no idea where to start. > >