Mini Maestro 24 as an LCD Driver

Hi,

I’m new to Pololu products and have been playing with the scripting language for a project I’m working on.

Just wanted to post my Mini Maestro 24 running a 4x20 LCD Display.

It only uses 12 outputs (11 for parallel inputs for the LCD and 1 to control the LED backlight). This leaves 12 other I/O’s for whatever you choose, I just decided to show it working with a simple pot on input 0 and displaying the value on the LCD (converted to a percentage).

Would like to know if anyone else has driven an LCD with the Maestro.

If
cool, did it work ok?
else
what do you think of this one?
Endif

:smiley: Dev.

Hello, Dev.

We have never heard of anyone doing something like that before. That is really cool! Thank you for sharing. We would love to know more details about your project and showcase it on our Community Projects blog.

if (youAreWilling)
Can you please share your code and/or settings file?
else
It’s ok. That is still a great project.
endif

-Jamee

Hi,

Yes I don’t mind posting the code.

I feel these devices can do so much more than just control servos and can access all kinds of devices to add to any project.

This is only part of my project to control a fully functional 24 DOF robotic hand that I have designed with CAD and am currently making using a milling machine at home.

I don’t want to reveal too much just yet. It may take some time to complete as I work on it in my spare time.

The Code below - I wrote it just after connecting a 16x1 line display, it only has capital characters at the moment, but can be added to quiet easily, for binary code for each character there is a lookup table on most LCD pdf’s. Also in the code is the ability to write to any part of the display, as in the video, it only updates the percentage part, and not the whole display (This would reduce value refresh time). I needed to see what was happening in the script without a pc connected.

Output Channels as follows: -

Channel 12 = Reg Select
Channel 13 = Read/Write
Channel 14 = Enable
Channel 15 = DB0
Channel 16 = DB1
Channel 17 = DB2
Channel 18 = DB3
Channel 19 = DB4
Channel 20 = DB5
Channel 21 = DB6
Channel 22 = DB7
Channel 23 = Backlight

I may just try an Orangutan next :smiley:.

Enjoy the code,

Dev.

# LCD Driver script

Setup1
Clear
Home
Line1
_ _ _ _ P _ O _ L _ O _ L _ U
Line2
_ _ M i n i _ m a e s t r o _ 24 dec-display
Line3
_ E n g a g e _ y o u r _ b r a i n
Line4
_ _ _ I n p u t _ 1 dec-display _ =

Begin
Home
1 get_position
10 times
102 divide
Value
Dec-Display
% _
Repeat

Sub Scroll
 Shift
Return

Sub Home
 0 0 0 0 0 0 0 0 0 1 0
 RS-DB7
 Step
 Text
Return

Sub Dec-Display # Write a decimal number up to 32767 to LCD Display
 Text
 Num-Brake
 More-Values:
 Dec-Disp-Byte 
 DB0-DB7
 Step
 dup
 10 less_than
 if
 goto More-Values
 else
 drop
 endif
Return

Sub Num-Brake # Brake a large number into component parts and place each one on the stack
32767
swap
dup
9 greater_than
if
dup
10000 divide
 dup
 2 roll
 dup
 2 roll
 10000 times
 minus
 dup
 2 roll
 drop
1000 divide
 dup
 2 roll
 dup
 2 roll
 1000 times
 minus
 dup
 2 roll
 drop
100 divide
 dup
 2 roll
 dup
 2 roll
 100 times
 minus
 dup
 2 roll
 drop
10 divide
 dup
 2 roll
 dup
 2 roll
 10 times
 minus
 dup
 2 roll
 drop
 drop
1 roll
2 roll
3 roll
4 roll
Check0:
dup
0 equals
if
 drop
 goto Check0
endif
endif
Return

Sub Dec-Disp-Byte # 8-bits with MSB at top of the stack for writing to display.
dup
0 equals
if
 drop
 0 0 1 1 0 0 0 0
else
 dup
 1 equals
 if
  drop
  0 0 1 1 0 0 0 1
 else
  dup
  2 equals
  if
   drop
   0 0 1 1 0 0 1 0
  else
   dup
   3 equals
   if
    drop
    0 0 1 1 0 0 1 1
   else
    dup
    4 equals
    if
     drop
     0 0 1 1 0 1 0 0
    else
     dup
     5 equals
     if
      drop
      0 0 1 1 0 1 0 1
     else
      dup
      6 equals
      if
       drop
       0 0 1 1 0 1 1 0
      else
       dup
       7 equals
       if
        drop
        0 0 1 1 0 1 1 1
       else
        dup
        8 equals
        if
         drop
         0 0 1 1 1 0 0 0
        else
         dup
         9 equals
         if
          drop
          0 0 1 1 1 0 0 1
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
Return

Sub Dec-Bin 
begin
dup # try using the number to be resolved for how many 0's to add i.e 1=1, 2=2, 3=2, 4=3, ect. Use if statements possibly
10 times
2 divide
Over
2 divide dup rot swap
10 times
minus
5 equals rot rot swap drop
dup while
repeat
drop

Return

Sub Shift # Display or Curser Shift Left/Right
 0 0 0 0 0 0 1 1 1 0 0
 RS-DB7
 Step
Return

Sub Text # Type text after RS-DB7 with a space in between letters i.e H E L L O, for a space use _
 1 0 0 0 0 0 0 0 0 0 0 
 RS-DB7
Return

Sub Setup1
 0 0 0 0 0 0 0 0 0 0 0
 RS-DB7
 LCD
Return

Sub RS-DB7
 DB0
 DB1
 DB2
 DB3
 DB4
 DB5
 DB6
 DB7
 Enable
 R/W
 RS
Return

Sub DB0-DB7
 DB0
 DB1
 DB2
 DB3
 DB4
 DB5
 DB6
 DB7
Return

Sub RS
 Logic
 12 Servo
Return

Sub R/W
 Logic
 13 Servo
Return

Sub Enable
 Logic
 14 Servo
Return

Sub Step
 1 Enable
 0 Enable
Return

Sub DB0
 Logic
 15 Servo
Return

Sub DB1
 Logic
 16 Servo
Return

Sub DB2
 Logic
 17 Servo
Return

Sub DB3
 Logic
 18 Servo
Return

Sub DB4
 Logic
 19 Servo
Return

Sub DB5
 Logic
 20 Servo
Return

Sub DB6
 Logic
 21 Servo
Return

Sub DB7
 Logic
 22 Servo
Return

Sub Logic
 2000 times
 922 plus
 4 times
Return

Sub LCD
 Function
 Display
 Entry_Mode
Return

Sub Function
 0 0 0 0 0 1 1 1 0 0 0
 RS-DB7
 Step
Return

Sub Display
 0 0 0 0 0 0 0 1 1 0 0
 RS-DB7
 Step
Return

Sub Entry_Mode
 0 0 0 0 0 0 0 0 1 1 0
 RS-DB7
 Step
Return

Sub Clear
 0 0 0 0 0 0 0 0 0 0 1
 RS-DB7
 Step
Return

Sub LINE1
 0 0 0 1 0 0 0 0 0 0 0
 RS-DB7
 Step
 1 0 0 0 0 0 0 0 0 0 0
 RS-DB7
Return

Sub LINE2
 0 0 0 1 0 1 0 1 0 0 0
 RS-DB7
 Step
 1 0 0 0 0 0 0 0 0 0 0
 RS-DB7
Return

Sub LINE3
 0 0 0 1 0 0 1 0 1 0 0
 RS-DB7
 Step
 1 0 0 0 0 0 0 0 0 0 0
 RS-DB7
Return

Sub LINE4
 0 0 0 1 1 0 1 0 1 0 0
 RS-DB7
 Step
 1 0 0 0 0 0 0 0 0 0 0
 RS-DB7
Return

Sub Value
 0 0 0 1 1 1 0 0 0 0 1
 RS-DB7
 Step
 1 0 0 0 0 0 0 0 0 0 0
 RS-DB7
Return

Sub A
 0 1 0 0 0 0 0 1
 DB0-DB7
 Step
Return

Sub B
 0 1 0 0 0 0 1 0
 DB0-DB7
 Step
Return

Sub C
 0 1 0 0 0 0 1 1
 DB0-DB7
 Step
Return

Sub D
 0 1 0 0 0 1 0 0
 DB0-DB7
 Step
Return

Sub E
 0 1 0 0 0 1 0 1
 DB0-DB7
 Step
Return

Sub F
 0 1 0 0 0 1 1 0
 DB0-DB7
 Step
Return

Sub G
 0 1 0 0 0 1 1 1
 DB0-DB7
 Step
Return

Sub H
 0 1 0 0 1 0 0 0
 DB0-DB7
 Step
Return

Sub I
 0 1 0 0 1 0 0 1
 DB0-DB7
 Step
Return

Sub J
 0 1 0 0 1 0 1 0
 DB0-DB7
 Step
Return

Sub K
 0 1 0 0 1 0 1 1
 DB0-DB7
 Step
Return

Sub L
 0 1 0 0 1 1 0 0
 DB0-DB7
 Step
Return

Sub M
 0 1 0 0 1 1 0 1
 DB0-DB7
 Step
Return

Sub N
 0 1 0 0 1 1 1 0
 DB0-DB7
 Step
Return

Sub O
 0 1 0 0 1 1 1 1
 DB0-DB7
 Step
Return

Sub P
 0 1 0 1 0 0 0 0
 DB0-DB7
 Step
Return

Sub Q
 0 1 0 1 0 0 0 1
 DB0-DB7
 Step
Return

Sub R
 0 1 0 1 0 0 1 0
 DB0-DB7
 Step
Return

Sub S
 0 1 0 1 0 0 1 1
 DB0-DB7
 Step
Return

Sub T
 0 1 0 1 0 1 0 0
 DB0-DB7
 Step
Return

Sub U
 0 1 0 1 0 1 0 1
 DB0-DB7
 Step
Return

Sub V
 0 1 0 1 0 1 1 0
 DB0-DB7
 Step
Return

Sub W
 0 1 0 1 0 1 1 1
 DB0-DB7
 Step
Return

Sub X
 0 1 0 1 1 0 0 0
 DB0-DB7
 Step
Return

Sub Y
 0 1 0 1 1 0 0 1
 DB0-DB7
 Step
Return

Sub Z
 0 1 0 1 1 0 1 0
 DB0-DB7
 Step
Return

Sub _
 0 0 1 0 0 0 0 0
 DB0-DB7
 Step
Return

Sub %
 0 0 1 0 0 1 0 1
 DB0-DB7
 Step
Return

Sub =
 0 0 1 1 1 1 0 1
 DB0-DB7
 Step
Return

P.S.

I haven’t cleaned up the code much, so you might see some random bits in it.

Dev.