I use the GLCD_KS0108 & GLCD_COMMON library's to control the GLCD on my
Easypic V7 devboard..... When i use the GLCD_LINE procedure for a vertical
line, then something goes wrong....
I see only a few dots....
(no problem with horizontal lines or diagonal lines)
after drawing the characters on the display, the horizontal lines are
splitted into different pieces (there's a gap above end below each
character)....
I want to generate a keypad on my LCD with this procedure. I don't think
JAL has support for 2D Arrays (or at least i don't know the syntax).... But
if possible, 2D arrays can simplify this code. See comments between code:
procedure generate_keypad() is
var byte i, j
glcd_clear_screen()
;first line is a "command" line where you see what you have done
yet
glcd_char_goto(2,0)
const byte adres [] = "Adres:"
print_string(glcd,adres)
;generating gridlines for 4x4 GLCD keypad
;last (5th) horizontal and vertical line doesn't follow pattern
for 4 using i loop
glcd_line(32*i,63,32*i,10)--vertical lines
glcd_line(0,8+14*i,127,8+14*i)--horizontal gridlines
end loop
;5th vertical and horizontal line
glcd_line(127,10,127,63)
glcd_line(0,63,127,63)
; 5 special function buttons, can't put this into the keypad_characters
array
; as far as I Know, Jal doesn't support multi-dimensional arrays....
const byte f0 [] = "f0"
const byte f1 [] = "f1"
const byte f2 [] = "f2"
const byte f3 [] = "f3"
const byte f4 [] = "f4"
;the characters in "keypad_characters[]" are placed on a grid with
predefined
;coordinates in these arrays
const byte keypad_x_position[4] ={10,42,72,98}
const byte keypad_y_position[4] ={12,26,40,54}
const byte keypad_characters [16] = {"7","8","9"," ",
"4","5","6"," ",
"1","2","3"," ",
"M","0"," "," "}
var byte char_counter = 0
for 4 using i loop
for 4 using j loop
glcd_write_char(keypad_x_position[j],keypad_y_position[i],keypad_characters[char_counter])
char_counter=char_counter+1
end loop
end loop
;need to override the blanks in keypad_characters[] to add the special
function
;buttons on the display (because I need the 2D array to do this in the
nested for loops above)
glcd_char_goto(98,12)
print_string(GLCD,f4)
glcd_char_goto(98,26)
print_string(GLCD,f3)
glcd_char_goto(98,40)
print_string(GLCD,f2)
glcd_char_goto(98,54)
print_string(GLCD,f1)
glcd_char_goto(72,54)
print_string(GLCD,f0)
;this doesn't work: no support for multi-dimensional Array in JAL?
;also: characters are not placed on the coordinate grid, instead on one
line
;at the top
; var byte char_counter = 0
; for 4 using i loop
; for 4 using j loop
; glcd_char_goto(keypad_x_position[j],keypad_y_position[i])
; print_string(GLCD,keypad_characters[char_counter])
; delay_100ms(5)
; char_counter=char_counter+1
; end loop
; end loop
end procedure
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/jallib.
For more options, visit https://groups.google.com/d/optout.