Our new official repo is on github
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases

custom chars multiplexing

Discuss anything to do with plugins

Moderators: _X7JAY7X_, caesar, IFR, mattcro, limbo

Post Reply
lucas_siglo21
Posts: 71
Joined: November 18th, 2007, 6:11 pm
Location: Bariloche, Argentina
Contact:

custom chars multiplexing

Post by lucas_siglo21 »

hi, i am an user of this program to control my 2x16 lcd display, it is a very good program and very customizable.
i was working on some plugins, but now i am working with something really interesting, there is a way to use more than 8 custom chars, you can simply multiplex them by time, the logic is:
turn on set 1->turn off set 1 and turn on set 2 -> turn off set 2 and turn on set 1 ->....
the plugin is done, but the only and major problem is speed, i need like 25-30 screen updates per second and i can't get them, maybe to get more speed it should be included in the core of the program, or something that i don't know, my code is written in VB.NET 2008
here is the source code:

Code: Select all

    Dim mom As Boolean
    Dim a, b, c, d As Boolean
    Public Function function1(ByVal param1 As String, ByVal param2 As String) As String
start:
        If mom = True Then
            If param1 = 1 And a = False Then
                a = True
                Return "$CustomChar(8,14,27,10,27,10,27,14,0)$Chr(136)"
            End If
            If param1 = 2 And b = False Then
                b = True
                Return ""

            End If
            If a = True And b = True Then
                mom = False
                GoTo reset
            End If
        Else
            If param1 = 1 And c = False Then
                c = True
                Return ""

            End If
            If param1 = 2 And d = False Then
                d = True
                Return "$CustomChar(8,14,10,14,0,0,0,0,0)$Chr(136)"
            End If
            If c = True And d = True Then
                mom = True
                GoTo reset
            End If
        End If
reset:
        a = False
        b = False
        c = False
        d = False
        GoTo start
    End Function
you call the plugin by writing:
$dll(name,1,1,) <--Set1
$dll(name,1,2,) <--Set2

now there are 2 custom chars defined directly in the code for testing, but the idea is to send them to the plugin.

sorry for my english

bye
limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

Nice work


Can you offer a compiled version of it?
If not I can upload it for you... :)
caesar
Forum Supporter
Posts: 734
Joined: October 15th, 2005, 10:39 am
Location: Romania
Contact:

Post by caesar »

Actually there is a problem with it.

1. LCDSmartie updates the screen whenever something is changed and then only updates the changed line.

2. Custom characters have a large overhead: they take at least 8x the normal time for a byte to be transmitted. Even greater than that for serial displays (10-15x depending on protocol)

3. Serial displays can communicate usually at 9600bps - 1200 characters per second and with a maximum of 115200bps - 14400 characters per second and that comes with a great overhead, not usable for more than 8 custom chars.

I would advise you to tap directly into the parallel port display driver and put the code in there. Be prepared to see some high CPU usage though!

You should put a display cache in the driver, then check what custom chars are used and allocate dynamically the 8 available. then send it out at least at 30 screens / second. The HD44780 can take 100.000 bytes / second so you should be good.

The next version of Smartie will have support for 256 custom characters so you will have total freedom!
Dot matrix character displays use chars 0 to 7 for custom characters. then comes the ASCII table and beginning with 128 are the general unused characters. You are free to define 128 characters, if you can manage the output. Maybe another 8 chars won't be too much a problem doing them this way!

PS: the hd44780 driver is written in Delphi, tell me if you need help with Delphi! Or you can do it from scrach - basically you will have to export some functions for Smartie.
lucas_siglo21
Posts: 71
Joined: November 18th, 2007, 6:11 pm
Location: Bariloche, Argentina
Contact:

Post by lucas_siglo21 »

ok, first i'll try the idea with a program written from scrach and see if i can update the screen quick enough
then maybe i will mess with drivers, but i've no idea about it
i'll upload the compiled version if you want
edit:
here it is: http://rapidshare.com/files/146582314/mult.dll
lucas_siglo21
Posts: 71
Joined: November 18th, 2007, 6:11 pm
Location: Bariloche, Argentina
Contact:

Post by lucas_siglo21 »

new discovers:

i've done an app from scratch in vb.net to try this with an ocx library to control the HD44780 displays:
http://www.freedownloadscenter.com/Prog ... e_OCX.html

and i try, with more than 50 screen updates per second the lcd doesn't show both chars, i think it can't update so fast,
less than 50 you can see them blink
and with fifty you see both but with a poor and variable contrast
it is not very stable, i wouldn't use it

i noted something very strange, i could write the first 16 chars as special chars!!

maybe my display is special, i don't know, but it is the cheapest and crappy display you could imagine.

how will you do to rewrite the ascii table?
mattcro
Forum Supporter
Posts: 590
Joined: March 8th, 2006, 1:58 pm
Location: Scotland

Post by mattcro »

The optical response time (change from dark to light) for most LCDs is 100ms or more, so many displays won't give a clear display at refresh rates above 10fps - on my TN display it's hard to read changing or scrolling text at any more than about 120ms refresh/scroll rate.

On HD44780 and KS0066 displays I've used you can write to the first 16 character table entries, but they're duplicates so you only get 8 unique custom characters.
Post Reply