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

Program Logic

General discussion about LCD Smartie.

Moderators: _X7JAY7X_, caesar, IFR, mattcro, limbo, Fast351

Post Reply
Rafael_Brazil
Plugin Author
Posts: 54
Joined: November 20th, 2005, 2:05 pm
Location: Curitiba, Paran?, Brazil
Contact:

Program Logic

Post by Rafael_Brazil »

Team,

A VFD Display, need that you send to data pins a HEX instruction to show a character that you want! right?

For example... I need to print a letter "R"

In this VFD, I need to send PortOut(888, &H52)

And we have the "R" in the next cursor position... that?s good!

My idea is use one string with the human chars... and an array with the hex codes...

string1 = "ABC"

string2 = "20 21 22"

array = split(string2)

C is the second position in String1, if we have the number 2, it?s just send it

PortOut(888, "&H" & array(2))

The ascii table of this VFD is diferent from the PC...

My question:

Is there a best way to do this?

This is part of my code:

b2 = " !""#$%&'()*+,-./"
h2 = "20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f "
b3 = "0123456789:;<=>?"
h3 = "30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f "
b4 = "@ABCDEFGHIJKLMNO"
h4 = "40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f "
b5 = "PQRSTUVWXYZ[?]^_"
h5 = "50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f "
b6 = "`abcdefghijklmnop"
h6 = "60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f "
b7 = "qrstuvwxyz{?}? "
h7 = "70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f "
ba = "??????????????? "
ha = "a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af "
bb = "??????????? ?"
hb = "b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf "
bc = "??????????????? "
hc = "c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf "
bd = "??? ?????? ? ?"
hd = "d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df "
be = " "
he = "e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef "
bp = "?"
hp = "c0"

banco = b2 & b3 & b4 & b5 & b6 & b7 & ba & bb & bc & bd & be & bp
hexa = h2 & h3 & h4 & h5 & h6 & h7 & ha & hb & hc & hd & he & hp

enderecos = Split(hexa)

:cry:
ReverseEngineered
Plugin Author
Posts: 192
Joined: January 18th, 2006, 11:09 pm
Location: Saskatoon, Saskatchewan, Canada

Post by ReverseEngineered »

Actually, there's a much simpler way to do this.

Make a character map array, which is an array of:
CharMap array[0..255] of char;

Then loop through your input string character by character, using the value of the character at that position as the index into the CharMap array.

This will be much faster, avoiding all of the processing necessary to split and match strings.

I don't know Delphi very well yet, and I don't my reference book handy, so I can't give you actual code, but I'm sure you should be able to write the code for what I have described.
Rafael_Brazil
Plugin Author
Posts: 54
Joined: November 20th, 2005, 2:05 pm
Location: Curitiba, Paran?, Brazil
Contact:

Post by Rafael_Brazil »

thanks reverse... I will try to make these changes... Thanks! :D
Post Reply