comp.lang.ada
 help / color / mirror / Atom feed
From: rrr.eee.27@gmail.com
Subject: Re: Cleanest Ada way to do this?
Date: Mon, 23 Jun 2014 02:02:18 -0700 (PDT)
Date: 2014-06-23T02:02:18-07:00	[thread overview]
Message-ID: <623dacba-5886-4b16-8694-950e7cc5a626@googlegroups.com> (raw)
In-Reply-To: <7eaee5fc-2045-4bb3-8b16-d757b54760da@googlegroups.com>

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 Ada. I'm writing to an LCD character display, in 4-bit mode, which requires writing 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) := Some_Char(4..7); ..twiddle some other control bits.. Port32(4..7) := 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 RegisterSelect lines (for the standard LCD controller HD44780). Those have to be written in parallel. the second nibble (other half of the byte) has to follow 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 have to find your own solution based on your hardware.

HTH
    Rolf

  parent reply	other threads:[~2014-06-23  9:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-22 16:51 Cleanest Ada way to do this? Mike Silva
2014-06-22 19:07 ` Simon Clubley
2014-06-22 21:20   ` Mike Silva
2014-06-22 21:05 ` Shark8
2014-06-23  0:17   ` Simon Clubley
2014-06-23  6:46     ` hungupharps
2014-06-23  7:32       ` Georg Bauhaus
2014-06-23 11:48         ` Simon Clubley
2014-06-23 15:40           ` G.B.
2014-06-23  9:02 ` rrr.eee.27 [this message]
2014-06-23 11:57   ` Simon Clubley
2014-06-23 12:05     ` rrr.eee.27
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox