Go Down

Topic: Serial LCD 128x64 Sparkfun Duda (Read 3984 times) previous topic - next topic

PascuaL

Y lo que falta(no cabía en el otro):
Quote
0x08:   toggle aux font. This command toggles which font is used for rendering text(does not effect characters already displayed, just what comes after)

0x0A:   set font mode. This determines how the font is rendered to the screen. it uses the same modes as bitblt(since the characters are rendered using bitblt)
        mode 7(copy) is default and this mode respects reverse. ie it will clear pixels to draw characters if reverse=1. the other modes do not respect reverse
        you get whatever the logical operation gives. (characters in internal memory are stored set on clear)
        0= AND
        1= NAND
        2= OR
        3= NOR
        4= XOR
        5= NXOR
        6= don't uses this one, will result in corrupted characters
        7= COPY (this is the default, overwrites whatever is in the background, and is the only one that respects reverse)

0x0B:   draw sprite. draws a sprite to the screen. arguments are x, y, sprite#, mode. 
        ex: (0x7C 0x0B 0x20 0x20 0x00 0x04) will XOR sprite 0 with the background at location (32,32)

0x0C:   line. draws a line onm the screen. arguments are x1,y1,x2,y2,S_R with S_R=0 clearing pixels, and S_R=1 setting them. (respects reverse, ie if reverse=1, S_R=1 clears pixels)

0x0D:   upload sprite.(NUM_SPRITES=8, SPRITE_SIZE=34 by default, to change this requires re-compiling the code) takes 1 argument and SPRITE_SIZE data bytes.
        send the sprite number first (0..(NUM_SPRITES-1) ) if the value sent is out of range, it will be coereced to (NUM_SPRITES-1)
        the sprite data is: [width][height][(SPRITE_SIZE-2) bytes of image data]
        image data is stored left to right, top to bottom. each byte defines an 8 pixel vertical stripe. so an nx8 sprite is n bytes long. one byte for each column.
        if the image is taller than 8 pixels, then the next n bytes store the next row. height doesn't have to be a multiple of 8, but there must be enough rows so 
        that (Number of rows)*8 >= (height in pixels). For example a 10x10 sprite would require 10 bytes/row(for x dimension) and 2 rows(2*8=16>10) or 20 bytes total

        an example sprite is the sparkfun logo. to upload this would require :
        0x7C 0x0D 0x0N 0x0A 0x10 0x80 0xc0 0x40 0x0c 0x3e 0xfe 0xf2 0xe0 0xf0 0xe0 0xff 0x7f 0x3f 0x1f 0x1f 0x1f 0x1f 0x0f 0x07 0x03 ...  0x00
                  spr#  W    H  |<---------------------------------------------------------(SPRITE_SIZE-2) bytes of image data--------------->|

        notice that the logo itself is 10x16 and only requires 20 bytes to define, but you must send all (SPRITE_SIZE-2) image data bytes (data after those necessary to draw the sprite are ignored) or the display will get out of sync

        there is a program in the utilities folder to convert a 24bbp bitmap to a sprite. it outputs the exact sprite data in binary format to stdout.

0x0F:   draw box. This command draws an outline of a box with corners x1,y1,x2,y2 and S_R for line type (respects reverse)
        so to draw a box from (5,5) to (15,15) would be (0x7C 0x0F 0x05 0x05 0x0F 0x0F 0x01) 

0x10:   set pixel. sets/resets a pixel. arguments x,y,S_R

0x12:   draw filled box. this draws a box much like the previous command, but the inside is filled with the fill byte. the fill byte describes 1 8-pixel high stripe
        that is repeated every x pixels and every 8 y pixels. the most useful are 0x00 to clear the box, and 0xFF to fill it.
        arguments x1,y1,x2,y2,fillbyte

0x14:   reverse mode. toggles reverse(white on black) mode. the new reverse mode inverts the screen in place, it does not clear the screen or change the text drawing position

0x15:   toggle splash. toggles wheather or not splash screen is displayed on startup. persistant over power cycles.

0x16:   bitblt. The bitblt command allows you to draw graphics to the screen like sprites, but the data doesn't have to be uploaded first, and there is no size
        restrictions.(other than the drawable area of the display) the arguments are x, y, mode, w, h, [data]
        the width and height are ordered so you can send sprite data directly to bitblt from a file with a terminal program. sent the x,y,mode bytes first, then
        send the file(ie made with the bmp2bin_sprite program in the utilities folder)

0x18:   set x_offset. sets the x coordinate where the upper left corner where the next character will be drawn. 1 argument.

0x19:   set y_offset. sets the x coordinate where the upper left corner where the next character will be drawn. 1 argument.

The next commands are exposed intefaces to the internal LCD read/write functions. I would recommend not using them, but if there is something you absolutely can't
do with the standard graphical functions, this gives you direct access to the LCD

0x1A:   write command, writes a command to the LCD controller chips. this does not set the address registers, they must be set before hand.
        takes 2 arguments the byte to write, and 1, 2 or 3 to select which of the 2 KS0108 chips to send it to. (3=both)

0x1B:   write data, writes a data byte to the LCD controller chips. this does not set the address registers, they must be set before hand.
        takes 2 arguments the byte to write, and 1, 2 or 3 to select which of the 2 KS0108 chips to send it to. (3=both)

0x1C:   write block, slightly higher level function. writes a sequence of bytes to the display. automatically crosses chips, and sets proper registers for you.
        takes 3 arguments and data bytes. arguments are: x coordinate, page, and length of data (max 128)
        after the 3 argument bytes are sent send [length] data bytes.

0x1D:   read data, reads a data byte from one of the controller chips. this does not set the address registers, they must be set before hand.
        takes 1 argument {1 or 2} to select which KS0108 to read, returns data byte on uart (if debug_level is 0 or 1 it will be a binary value, otherwise it will be ASCII)

0x1E:   read byte, slightly higher level function. returns a byte at a specific x coordinate(page must be set seperately)
        takes 2 arguments, x-coordinate and side={1,2} to select the chip to read. 
        returns value on uart (if debug_level is 0 or 1 it will be a binary value, otherwise it will be ASCII)

0x1F:   read block, slightly higher level function. returns a sequence of data bytes from a specific page. automatically crosses chips, and sets address registers for you
        takes 3 arguments, x-coordinate, page, length. returns the data on the uart (if debug_level is 0 or 1 it will be a binary value, otherwise it will be ASCII)

0x20:   set y reg. For reasons unknown. the datasheet for the KS0108 uses y to lable the horizontal axis. this sets the y register on the LCD controller chips.
        y counts from 0 to 63 and starts at the left of the display. any value over 63 is handled by the second chip.
        takes 1 argument, y-value and sets it on both chips simultaneously.
        
0x21:   set page. the display is broken up into 8 pages which describe horizontal rows 8 pixels high. pages start at 0 at the top of the display and go to
        7 at the bottom
        takes 1 argument, page, and sets both chips simultaneously.


Cheyenne

Siento no poder ayudarte, personalmente no he manejado nunca ese LCD y desde el móvil es complicado investigar. Tal vez alguna búsqueda en Google sobre el LCD y el firmware te lleve a alguna página que expliquen algo.
http://cuadricopterodiyarduino.blogspot.com/

PascuaL

Llevo ya como una semana haciéndolo...:(

PascuaL


Siento no poder ayudarte, personalmente no he manejado nunca ese LCD y desde el móvil es complicado investigar. Tal vez alguna búsqueda en Google sobre el LCD y el firmware te lleve a alguna página que expliquen algo.

¿Les escribo a Sparkfun?

PascuaL

https://www.sparkfun.com/products/9351
Aquí no me había metido y la gente en los comentarios se los comen..
Hablan mucho de que los comandos hexadecimales no coinciden con los que hay. Cheyenne si recuerdas, en mi código no coincidían las líneas, cambiando unos valores está solucionado. Ahora bien, hablan de la actualización de firmare; resulta que es la solución a los problemas. Pero claro, ¿cómo se actualiza?...=(

Cheyenne

Me alegro de que hayas encontrado una respuesta. Si indican que se soluciona con el nuevo firmware puedes poner la consulta de cómo instalarlo en ese foro o preguntar en la página del desarrollador.
http://cuadricopterodiyarduino.blogspot.com/

Go Up