Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 22:25 26 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : LCD shield

Author Message
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1425
Posted: 12:39pm 02 Jan 2013
Copy link to clipboard 
Print this post

I attached an LCD shield to a ColorMax and wrote a simple library for it.



Here is the LCD Shield library:


' ----------------------------------------------------
' LCDShield library
' ----------------------------------------------------

' ----------------------------------------------------
' Backlight on/off
' 0 = off, 1 = on
' ----------------------------------------------------
SUB LCDShield_Backlight ( LCDShield_blstate )
' pin = 31
SETPIN 31, 8
PIN(31) = LCDShield_blstate
END SUB


' ----------------------------------------------------
' Write 4-bit command
' ----------------------------------------------------
SUB LCDShield_Command4( LCDShield_value )

' Data lines
SETPIN 25, 8 : SETPIN 26, 8 : SETPIN 27, 8 : SETPIN 28, 8

' Register Select line
SETPIN 29, 8

' Enable line
SETPIN 30, 8

' Command
PIN(29) = 0

' Enable high
PIN(30) = 1 : PAUSE 1

' Value onto data lines
PIN(28) = LCDShield_value AND &B00001000
PIN(27) = LCDShield_value AND &B00000100
PIN(26) = LCDShield_value AND &B00000010
PIN(25) = LCDShield_value AND &B00000001

' Enable low then high
PIN(30) = 0 : PAUSE 1
PIN(30) = 1 : PAUSE 1

END SUB


' ----------------------------------------------------
' Write 8-bit character
' ----------------------------------------------------
SUB LCDShield_Character( LCDShield_value )

' Character
PIN(29) = 1

' Enable high
PIN(30) = 1 : PAUSE 1

' Value (high nibble) onto data lines
PIN(28) = LCDShield_value AND &B10000000
PIN(27) = LCDShield_value AND &B01000000
PIN(26) = LCDShield_value AND &B00100000
PIN(25) = LCDShield_value AND &B00010000

' Enable low then high
PIN(30) = 0 : PAUSE 1
PIN(30) = 1 : PAUSE 1

' Value (low nibble) onto data lines
PIN(28) = LCDShield_value AND &B00001000
PIN(27) = LCDShield_value AND &B00000100
PIN(26) = LCDShield_value AND &B00000010
PIN(25) = LCDShield_value AND &B00000001

' Enable low then high
PIN(30) = 0 : PAUSE 1
PIN(30) = 1 : PAUSE 1

END SUB


' ----------------------------------------------------
' Write string
' ----------------------------------------------------
SUB LCDShield_String( LCDShield_string$ )
FOR LCDShield_loop = 1 to LEN(LCDShield_string$)
LCDShield_Character( ASC(MID$(LCDShield_string$, LCDShield_loop )))
NEXT
END SUB


' ----------------------------------------------------
' Return button state
' 0 = no button
' 1 = right, 2 = up, 3 = down, 4 = left
' Because A/D on CGCOLORMAX is 3.3V max and this is a
' 5V resistor chain the SEL button does not work.
' ----------------------------------------------------
FUNCTION LCDShield_Button( )
' Button Input line
SETPIN 35, 1
LCDShield_Button = 0
IF PIN(35) < 2.85 THEN
LCDShield_Button = 4
ENDIF
IF PIN(35) < 1.95 THEN
LCDShield_Button = 3
ENDIF
IF PIN(35) < 1.1 THEN
LCDShield_Button = 2
ENDIF
IF PIN(35) < .32 THEN
LCDShield_Button = 1
ENDIF
END FUNCTION



Here is test/example code:


' ====================================================
'
' LCDShield example
'
' ====================================================

' Flash display
for a = 1 to 5
LCDShield_Backlight( 0 ) : PAUSE 40
LCDShield_Backlight( 1 ) : PAUSE 60
next a

' Initialize display
' Select 4 bit mode
LCDShield_Command4(&H03)
LCDShield_Command4(&H03)
LCDShield_Command4(&H03)
LCDShield_Command4(&H02)

' Select 4 bit mode, two LCD lines
LCDShield_Command4(&H02)
LCDShield_Command4(&H0C)

' Select display on, cursor off, no blink
LCDShield_Command4(&H00)
LCDShield_Command4(&H0C)

' Clear display
LCDShield_Command4(&H00)
LCDShield_Command4(&H01)


' Write Hi Mom! message to line 1
LCDShield_Character(72)
LCDShield_Character(73)

LCDShield_Character(32)

LCDShield_Character(77)
LCDShield_Character(111)
LCDShield_Character(109)

LCDShield_Character(33)

PAUSE 1000

' Clear display
LCDShield_Command4(&H00)
LCDShield_Command4(&H01)

' Write message to line 1
LCDShield_String ( "CircuitGizmos" )

' Move to line 2
LCDShield_Command4(&H0C)
LCDShield_Command4(&H00)

' Write message to line 2
LCDShield_String ( "Rules!" )

' Test buttons
for a = 1 to 500
PRINT LCDShield_Button()
PAUSE 1000
next a


Micromites and Maximites! - Beginning Maximite
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 12:58pm 02 Jan 2013
Copy link to clipboard 
Print this post

  CircuitGizmos said  I attached an LCD shield to a ColorMax and wrote a simple library for it


Very nice. I can't wait for my colour maxis to tun up.

As I have mentioned elsewhere, I have designed a number of pic based i2c devices including 12 (and 16) key keypad and 20x2 LCD. Looking forward to trying my modules out on the i2c bus. i2c bus obviates the need for a driver, just a couple of simple commands to send a command byte or character.

David M.
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1425
Posted: 02:50pm 02 Jan 2013
Copy link to clipboard 
Print this post

Thanks, David. They should be showing up soon.
Micromites and Maximites! - Beginning Maximite
 
centrex

Guru

Joined: 13/11/2011
Location: Australia
Posts: 320
Posted: 04:38pm 02 Jan 2013
Copy link to clipboard 
Print this post

Hi Gizmos
Will the updated version be advertised like the origonal ie discount on preorder.
Regards
CliffEdited by centrex 2013-01-04
Cliff
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1425
Posted: 05:09pm 02 Jan 2013
Copy link to clipboard 
Print this post

I've actually kept the discounted price in place. I expected to raise the price to 54.99, but since I will be coming out with a new version, I kept the old one at 49.99.

No preorder for version 2. When it is available, it will be posted on the CG website.
Micromites and Maximites! - Beginning Maximite
 
TinkersALot
Regular Member

Joined: 20/11/2012
Location: United States
Posts: 72
Posted: 07:34pm 02 Jan 2013
Copy link to clipboard 
Print this post

  CircuitGizmos said   I attached an LCD shield to a ColorMax and wrote a simple library for it.





LIKE A LOT!
 
Bill.b

Senior Member

Joined: 25/06/2011
Location: Australia
Posts: 226
Posted: 12:08am 03 Jan 2013
Copy link to clipboard 
Print this post

Is there an OLED display available.

BillEdited by Bill.b 2013-01-04
In the interests of the environment, this post has been constructed entirely from recycled electrons.
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1425
Posted: 06:09am 03 Jan 2013
Copy link to clipboard 
Print this post

Tons. Just google "OLED Arduino shield".
Micromites and Maximites! - Beginning Maximite
 
elproducts

Senior Member

Joined: 19/06/2011
Location: United States
Posts: 282
Posted: 06:18pm 03 Jan 2013
Copy link to clipboard 
Print this post

Well done.
I love to see Arduino shields and Maximite combine.

www.elproducts.com
 
TinkersALot
Regular Member

Joined: 20/11/2012
Location: United States
Posts: 72
Posted: 07:04am 08 Jan 2013
Copy link to clipboard 
Print this post

Here is another pretty neat board (hi I/O fanout for small pin demand on the 'driver side')

Not that there is any shortage of I/O on these little beasties, but I still think this is a neat little card.

http://www.robotshop.com/i-o-port-expander-shield-arduino.ht ml
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1425
Posted: 07:27am 08 Jan 2013
Copy link to clipboard 
Print this post

That shield uses three 8574 devices - I2C to 8 bits I/O - which I describe in my Beginning Maximite document. (The 8574 device, not the shield)

Don't buy a $35 board if you can wire up three $2 parts to do the job.
Micromites and Maximites! - Beginning Maximite
 
TinkersALot
Regular Member

Joined: 20/11/2012
Location: United States
Posts: 72
Posted: 07:34am 08 Jan 2013
Copy link to clipboard 
Print this post

  CircuitGizmos said   Don't buy a $35 board if you can wire up three $2 parts to do the job.


great advice!


I found what you were referring to on PP 100 in your document:

http://www.circuitgizmos.com/files/begmax.pdf

Thanks!Edited by TinkersALot 2013-01-09
 
elproducts

Senior Member

Joined: 19/06/2011
Location: United States
Posts: 282
Posted: 07:55am 08 Jan 2013
Copy link to clipboard 
Print this post

  CircuitGizmos said  
Don't buy a $35 board if you can wire up three $2 parts to do the job.


Wait, don't discount this idea strictly on price.
You could have also wired up an LCD module cheaper than that LCD shield but it wouldn't have been easier.

For some being able to simply plug in the hardware and then write simple code is worth saving a few dollars.
A kid with very limited electronics knowledge can get things running with a Maximite and a shield.
All they have to learn is some BASIC or better yet, download a code sample from one of the users here.

Plus it's cleaner than having a bunch of wires stuck in a breadboard lying around.

There are also cheaper alternatives such as the centipede shield that uses three I2C MCP23017 I/O expanders.

This is why I love the addition of the Arduino footprint and now easy access commands for expanding Maximite with Arduino shields.

It opens up new possibilities for beginners.

It also opens up possibilities for members of this site to show their talents and even maybe make a few dollars.

Create a library of Maximite code for a particular shield.
Offer it on your site or just open source the code.
Create a custom Shield and sell it through Don or directly.
Having a common I/O setup that is shared with Arduino opens a whole bunch of possibilities to what you can do with a color maximite.

www.elproducts.com
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1425
Posted: 08:09am 08 Jan 2013
Copy link to clipboard 
Print this post

My intent wasn't to suppress the use of shields. I'm decidedly "pro shield".

My intent was to offer a less expensive alternative. Note I said IF you can wire up your own alternative.

I agree with what you have to say. My simple example posted above is free library code for anyone to use with the LCD shield.

The Beginning Maximite document has example code that will work with a hand-wired PCF8574 as well as with the I/O shield (with slight changes).

I'm open to including custom shields on CircuitGizmos, too.

I'd like to see sub-directories in the Maximite library for shields. Each subdir for a particular shield type. Start with this LCD Shield as library code.


Micromites and Maximites! - Beginning Maximite
 
elproducts

Senior Member

Joined: 19/06/2011
Location: United States
Posts: 282
Posted: 06:04pm 08 Jan 2013
Copy link to clipboard 
Print this post

I understand. You don't have to defend yourself at all.
I just want to see more people see the power of the Maximite for beginner's who are many times beginners at electronics too. Arduino and Raspberry PI get all the attention but Maximite should be right up there as well.
I think what you've done with Geoff's Maximite designs is awesome.
You've made it easy and affordable to get into programming Maximite.
Your idea of subdirectories for shields is great.
www.elproducts.com
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024