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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.66.66.35 with SMTP id c3mr9284836pat.7.1403514139225; Mon, 23 Jun 2014 02:02:19 -0700 (PDT) X-Received: by 10.182.213.41 with SMTP id np9mr83739obc.3.1403514138951; Mon, 23 Jun 2014 02:02:18 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!hn18no6660070igb.0!news-out.google.com!gf2ni11igb.0!nntp.google.com!hn18no6660061igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 23 Jun 2014 02:02:18 -0700 (PDT) In-Reply-To: <7eaee5fc-2045-4bb3-8b16-d757b54760da@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=192.109.190.88; posting-account=mOyWBQoAAAD7S-NBmMUOr9hRClcL0vqR NNTP-Posting-Host: 192.109.190.88 References: <7eaee5fc-2045-4bb3-8b16-d757b54760da@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <623dacba-5886-4b16-8694-950e7cc5a626@googlegroups.com> Subject: Re: Cleanest Ada way to do this? From: rrr.eee.27@gmail.com Injection-Date: Mon, 23 Jun 2014 09:02:18 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:20550 Date: 2014-06-23T02:02:18-07:00 List-Id: On Sunday, June 22, 2014 6:51:01 PM UTC+2, Mike Silva wrote: > I'd like some help on the cleanest, or most elegant, way to do this in Ad= a. I'm writing to an LCD character display, in 4-bit mode, which requires w= riting an 8 bit character or command value as two 4 bit pieces. The port (a= memory address) being written to is 32 bits wide. What I would like to be = able to do is some form of this (not valid Ada, I know): Port32(4..7) :=3D = Some_Char(4..7); ..twiddle some other control bits.. Port32(4..7) :=3D Some= _Char(0..3); ..twiddle some other control bits.. Any thoughts? You have to drive not only the four data lines but also some Enable or Regi= sterSelect lines (for the standard LCD controller HD44780). Those have to b= e written in parallel. the second nibble (other half of the byte) has to fo= llow with specific timing. I recommend a look on lcd.ads, lcd.adb, and lcd-= wiring.ads from AVR-Ada at http://sourceforge.net/p/avr-ada/code/ci/master/= tree/avr/lcd/. You can probably leave out the dependancy on AVR and AVR.Strings in lcd.ads= as you are on a 32bit machine. The actual mapping of the ports and port bits is in LCD.Wiring. Here you ha= ve to find your own solution based on your hardware. HTH Rolf