In this post we will show how to control a Graphics LCD display using a Programmable Xbee module from Digi international.
Digi international delivers a SDK for the Programmable Xbee in a free way, you can downdload from here (http://ftp1.digi.com/support/developmentsoftware/40003003_B.exe).
One of the samples Digi deliver in the SDK is the Graphic display. This example draws different shapes in a graphic display based on the ST7565R chip. Depending on the button pressed from the XBee Interface Board, the display will show a circle or a rectangle.
To run this sample you need a S2B or S2C module with 128 KBytes of flash memory. The sample is not supported in standard 32 Kbytes flash memory modules.
You should connect the graphic display to the SPI interface of the XBee module.
Take a look to the “config.xml” file of the sample application to see how is configured each pin of Programmable Xbee.
In following schematic you have the connections.
Digi Programmable XBee SDK offers following API to control the graphics LCD display:
|void||lcd_graphic_cmd_write (uint8_t cmd)|
|Sends the given command to the LCD.|
|void||lcd_graphic_data_write (uint8_t data)|
|Sends a byte of data to be written in the LCD.|
|void||lcd_graphic_goto_xy (uint8_t x, uint8_t y)|
|Sets the pointer of the LCD at the specified coordinates.|
|Initializes graphic display with default params.|
|void||lcd_graphic_set_clear_screen (uint8_t data)|
|Fills all the display with the specified byte mask.|
|void||lcd_graphic_write_box (uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, bool_t color)|
|Draws a filled rectangle in the LCD defined by two points.|
|void||lcd_graphic_write_circle (uint8_t x0, uint8_t y0, uint8_t r, bool_t color)|
|Draws a circle in the LCD defined by its center point and the radius.|
|void||lcd_graphic_write_line (uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, bool_t color)|
|Draws a line in the LCD defined by two points.|
|void||lcd_graphic_write_pixel (uint8_t x, uint8_t y, bool_t color)|
|Draws a pixel in the LCD given position (point).|
|void||lcd_graphic_write_rectangle (uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, bool_t color)|
|Draws a rectangle in the LCD defined by two points.|
|void||lcd_graphic_write_text (uint8_t x0, uint8_t y0, uint8_t *textplot, bool_t color)|
|Writes the given text in the graphic display.|
|void||lcd_graphic_write_tile (uint8_t x, uint8_t y, uint8_t *buf)|
|Writes a tile (square of 8x8 pixels/bits) at the given point.|