Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECE 447 Fall 2009 Lecture 12: TI MSP430 External LCD.

Similar presentations


Presentation on theme: "ECE 447 Fall 2009 Lecture 12: TI MSP430 External LCD."— Presentation transcript:

1 ECE 447 Fall 2009 Lecture 12: TI MSP430 External LCD

2 Agenda Review Timer Example from previous Lecture External LCDs LCD Pseudocode Example

3 Timer_B Schematic

4 Last Lecture: MSP430 Class Exercise Write a Function that sets up Timer_B in Up Mode to generate a 1000Hz output wave. The duty cycle of the wave will be determined by the value read on PORT1. The value should be interpreted as unsigned and any value over 100 will be treated with a ceiling at 100. As the input on Port1 changes the PWM duty cycle will be adjusted.

5 ECE447: External LCD Intro Liquid Crystal Diplay (LCD) Uses less power than LEDs LCDs don’t emit light, they control intensity of reflected or transmitted light Works well in ambient light, requires a LED backlight for dark environments

6 ECE447: Types of LCDs Segmented LCDs –Like SSDs found in watches, meters, etc. –There’s a SoftBaugh SBLCDA4 on the experimental board Character-based LCDs –Dot-matrix display with 1-4 rows of 8-72 characters –Can typically display a set of ~256 ASCII characters –Addressed by sending a byte to define each char –Controlled with ~3bits –Included in your kit: AMOTEC ADM1602K Fully Graphical LCDs –Interface only needs a few pins –Needs a high data rate to set the value (shape, color, etc) of each pixel –Your cell phone!

7 ECE447: LCD Structure

8 ECE447: Biasing the LCD LCDs must be driven with AC not DC –Steady voltage will cause electrolysis of liquid crystal which will DESTROY THE DISPLAY! –Driven with square-waves in antiphase to give Vavg = 0V, ~100Hz –Handled by LCD Microcontroller Interface to MSP430 – data and instruction Registers

9 ECE447: AMOTEC 1602K 16 character by 2 line display 256 symbols for each character Runs at 3V Yellow LED Backlight

10 ECE447: Diagram and Pins

11 ECE 447: Character Positions and Patterns

12 ECE447: LCD Example Init_control Begin Set E to 0 Set RS to 0 (instruction code) end LCD_clear Begin Set D7-D0 to Display_Clear_Code Set E to 1 Set E to 0 Wait for LCD to process the instruction End LCD_write (char c) Begin Set RS to 1 (data input) Set D7-D0 to c Set E to 1 Set E to 0 Set RS to 0 (instruction) Wait for LCD to process the instruction End LCD_write_string(char * s) Begin while (*s != End of String ) Begin LCD_write(*s) s++ End LCD_move_cursor_to_position (int row, int column) Begin Set D7-D0 to DD_RAM_Address(row, column) | D7_MASK Set E to 1 Set E to 0 Wait for LCD to process the instruction End

13 ECE447: LCD Example – Cont’d #define LINE2_ADDR 0x40 #define LINE3_ADDR 0x14 #define LINE4_ADDR 0x54 int DD_RAM_Addr(int row, int column) { switch (row) { case 1: return column; case 2: return LINE2_ADDR + column; case 3: return LINE3_ADDR + column; case 4: return LINE4_ADDR + column; } char *menu1[] = {"1 - AVR. TEMPERATURE", "2 – MAX TEMPERATURE", "3-AVR. HUMIDITY", "4 - MAX. HUMIDITY"}; void display_menu(char *menu1[]) { int i; for (i=1; i<=4; i++) { LCD_move_cursor_to_position(i, 0); LCD_write_string(menu[i-1]); } Lcd_initialize Begin Sequence of instructions given by the LCD specification End

14 ECE447: Translations from Pseudocode Assumptions E is connected to P2.0 RS is connected to P2.1 RW is connected to ground D7-D0 are connected to P6 PseudocodeC Set E to 1#define E_SELECTOR 0x01 P2OUT |= E_SELECTOR; Set RS to 0#define RS_SELECTOR 0x02 P2OUT &=~RS_SELECTOR; Set D7-D0 to Initialization_Code#define LCD_INIT_CODE 0x30 P6OUT = LCD_INIT_CODE; Set D7-D0 to Function_Set_Code (8-bit data, 2-lines, 5x7 characters) #define LCD_FUN_CODE 0x38 P6OUT = LCD_FUN_CODE; Set D7-D0 to Clear_Code#define LCD_CLR_CODE 0x01 P6OUT = LCD_CLR_CODE; Set D7-D0 to DD_RAM_Address (row, column) | D7_MASK #define D7_MASK 0x80 P6OUT = DD_RAM_Addr(row, column) | D7_MASK;

15 Summary Review Timer Example from previous Lecture External LCDs LCD Pseudocode Example


Download ppt "ECE 447 Fall 2009 Lecture 12: TI MSP430 External LCD."

Similar presentations


Ads by Google