Showing posts with label Programmable XBee. Show all posts
Showing posts with label Programmable XBee. Show all posts

Thursday, December 6, 2012

Graphic Display Connected to the Programmable XBee


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.

Here a photo of the sample running:

Digi Programmable XBee SDK offers following API to control the graphics LCD display: 


voidlcd_graphic_cmd_write (uint8_t cmd)
Sends the given command to the LCD.
voidlcd_graphic_data_write (uint8_t data)
Sends a byte of data to be written in the LCD.
voidlcd_graphic_goto_xy (uint8_t x, uint8_t y)
Sets the pointer of the LCD at the specified coordinates.
voidlcd_graphic_init (void)
Initializes graphic display with default params.
voidlcd_graphic_set_clear_screen (uint8_t data)
Fills all the display with the specified byte mask.
voidlcd_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.
voidlcd_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.
voidlcd_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.
voidlcd_graphic_write_pixel (uint8_t x, uint8_t y, bool_t color)
Draws a pixel in the LCD given position (point).
voidlcd_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.
voidlcd_graphic_write_text (uint8_t x0, uint8_t y0, uint8_t *textplot, bool_t color)
Writes the given text in the graphic display.
voidlcd_graphic_write_tile (uint8_t x, uint8_t y, uint8_t *buf)
Writes a tile (square of 8x8 pixels/bits) at the given point.

Enjoy!


Tuesday, November 27, 2012

XBee playing "The Imperial March" using a buzzer


In this sample we show how to play a tune using a buzzer and the PWM interface of the Digi Programmable XBee module.

Here a video with the result:
Direct Link to the Video:  LINK


If you can try the sample, here is the source code: LINK

For this sample we are using the PWM API that provides the SDK delivered with the Digi Programmable XBee:
Pulse-Width Modulation (PWM)
Functions
int
pwm_config (xpin_t pin, bool_t enable, uint32_t ton, uint32_t period)
Function that configures the settings of the Pulse-Width-Modulation module.
int
pwm_enable (xpin_t pin, bool_t enable)
Function that enables/disables the Pulse-Width-Modulation.
Function that returns the current period for the Pulse-Width-Modulation component.
Function that returns the current positive semiperiod for the Pulse-Width-Modulation component.
Function that changes the positive pulse-width of the Pulse-Width-Modulation component.



Thanks to Sebas for the video and the source code!


Sunday, October 14, 2012

Connect a Character LCD to a Programmable XBee

Programmable XBee SDK delivered by Digi International is plenty of samples to show the power of the API developed for the Programmable XBee S2B and S2C modules from Digi International.

One of the sample delivered shows how to use Programmable XBee module to control a character LCD.
The CharLCD example delivered with the Programmable XBee SDK performs different actions in a character LCD based on the HD44780, KS0066U or equivalent display controller.
The purpose of this example is to show how to use the char_lcd driver/API.

To create the Character LCD sample you need to install Codewarrior 10.2 (You can download from Digi site Link.) and Programmable XBee SDK from Digi (you can download from Digi site: Link ).
Once installed, open Codewarrior 10.2, go to File -> New -> Programmable XBee Sample Project, in the new window that will pop up, select the sample "Char LCD Demo", you will find it under "Displays" item.

Now, you should build and flash into the Programmable XBee the character LCD demo application.
After flashing the demo, check that in serial console you have the application header, that means that the demo is running.

In next section we will show you how to connect the Programmable XBee and the character LCD.

Hardware connection:

In the config.xml you have the lines of Programmable XBee module that should be used for this example and should be connected to the character display.
Here you have a screenshot of the config.xml file for the character LCD sample.



Here you have the schematic to connect the Programmable XBee and the character LCD.
Note that the XBee module used is a Programmable XBee module, not the standard XBee module.

When you have set up all the hardware, connect the power supply and demo application will perform a sequence of actions in the character LCD

Character LCD connected to the Programmable XBee S2B.

Character LCD API:

Programmable XBee SDK offers following API for related with a character LCD:

  • Character LCD configuration functions: 
    • char_lcd_init() 
    • char_lcd_cmd_write() 
    • char_lcd_on_off() 
    • char_lcd_cursor_on_off() 
    • char_lcd_cursor_blink_on_off() 
    • char_lcd_clear() 
    • char_lcd_goto_xy() 
  • Functions to read/write the LCD: 
    • char_lcd_putchar() 
    • char_lcd_write() 
    • char_lcd_read_data_xy() 


For more information about the API you should have a look into the help delived with the Programmable XBee SDK.

Best regards,