Chapter 10 Glass Bliss Using the Parallel Master Port to communicate with Alphanumeric LCD displays.

Slides:



Advertisements
Similar presentations
Keeping the Sheep Corralled An engineer, a physicist, and a mathematician are shown a pasture with a herd of sheep, and told to put them inside the smallest.
Advertisements

I/O Organization popo.
INPUT-OUTPUT ORGANIZATION
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Lab 12 : Liquid Crystal Displays: Slide 2 Slide 3 Slide 4 Slide 5 Slide 6 Slide 7 DMD Basics : Slide 8 Slide 9 Slide 10 Slide 11 Slide 12 Data Write the.
C Examples 1.
Input and Output CS 215 Lecture #20.
MICROPROCESSORS TWO TYPES OF MODELS ARE USED :  PROGRAMMER’S MODEL :- THIS MODEL SHOWS FEATURES, SUCH AS INTERNAL REGISTERS, ADDRESS,DATA & CONTROL BUSES.
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
TK2633 Introduction to Parallel Data Interfacing DR MASRI AYOB.
Microprocessor and Microcontroller
Chapter 11 It’s an Analog World Learning to use the Analog to Digital Converter.
Introduction of Holtek HT-46 series MCU
Spring EE 316 Computer Engineering Junior Lab LCD modules.
C Programming Interfacing C to Hardware LCD Interface Code /* define X and Y PIT registers on bus slot D */ #define PIT0xFFF58300 #define XPGCR(*
8.7 Memory management Program E Program D System memory DOS INT 21, function 48H: Allocate Memory Specification: allocates a number of memory paragraphs.
Chapter 7 Interupts DMA Channels Context Switching.
MP3 player on PC using PIC controller via USB. Supervisor: Dmitry Sokolik Performed by: Yoav Gershoni Shachar Faigenblat.
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
Chapter 8 Communication Introduction to serial communication interfaces. Examples of use of the SPI module.
16x2 LCD Module on DE2-115 數位電路實驗 TA: 吳柏辰 Author: Trumen.
LCD's 1. LCD Types Many types available. Most common are:  Character Pre-programmed with a set of alphanumeric characters & symbols Size range from 8×1.
KyungHee Univ. 2-0 Parallel Port LCD Interface with the HD44780 Controller.
INPUT-OUTPUT ORGANIZATION
Chapter 12 Capturing Input. Di Jasio - Programming 32-bit Microcontrollers in C Button Inputs.
Digital Outputs LCD Display
The Serial Peripheral Interface (SPI) Chapter 8 CML9S12-DP256.
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
Chapter 2 A Loop in the Pattern Designing the Main Loop and Timing.
MICROPROCESSOR INPUT/OUTPUT
Practical Electronics & Programming
1 Copyright (c) 2003 by Valery Sklyarov and Iouliia Skliarova: DETUA, IEETA, Aveiro University, Portugal.
CS-280 Dr. Mark L. Hornick 1 Programming for the LCD Display.
UniMAP 1 Interfacing Peripherals. UniMAP 2 Interfacing devices on Embedded Linux In general, to interface to a device connected to an embedded Linux platform.
FREQUENCY COUNTER USING Silicon Labs C8051F020 microcontroller
8279 KEYBOARD AND DISPLAY INTERFACING
9-1 EE 319K Introduction to Microcontrollers Lecture 9:I/O Synchronization; LCD Interfacing; Implementing Local Variables using a Stack Frame; Parameter.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
8279 KEYBOARD AND DISPLAY INTERFACING
Chapter 5 - Interrupts.
Programming Microcontrollers in C Lecture L7.1. C Data Types TypeSizeRange char1 byte-128 – 127 unsigned char1 byte0 – 255 Int2 bytes – unsigned.
Department of Electronic & Electrical Engineering LCD character display (parallel interface). How to interface a LCD character display to a PIC.
UNIT 7 - INTRODUCTION TO I/O INTERFACING. TWO MAJOR TYPES OF I/O INTERFACING ISOLATED I/O - DEDICATED I/O INSTRUCTIONS ARE USED TO ACCESS I/O DEVICES.
بسم الله الرحمن الرحيم MEMORY AND I/O.
ECE 447 Fall 2009 Lecture 12: TI MSP430 External LCD.
Direct-Access Color Graphics Chapter 11. Graphics modes C++ provides a different combination of graphics characteristics. These characteristics include.
Vishwakarma government engineering college Prepare by. Hardik Jolapara( ) LCD Interfacing with ATmega16.
Introduction to Projects using Microcontroller Md. Khalilur Rhaman Credit: Interface Lab.
Interfacing of Input/Output devices with AVR Microcontroller Enrolment No. : Name of the student: SOMAIYA ISHA.
Sitarambhai Naranjibhai Patel Institute of Technology and Research Centre, Umrakh, Bardoli. A Presentation On “ 16x2 LCD Interfacing with AVR atmega32.
LCD AND LCD INTERFACING. INDEX:-  INTRODUCTION  PIN DISCRIPTION  INITIALIZATION OF LCD  LCD INTERFACING  LCD INTERFACING WITH ATMEGA 32  INTERFACING.
CEng3361 CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT Spring 2011 Recitation 06.
INT. TO EMBEDDED SYSTEMS DEVELOPMENT
LCD Interfacing using Atmega 32
LCD and Keyboard Interfacing
UNIVERSAL COLLEGE OF ENGINEERING & TECHNOLOGY
GANDHINAGAR INSTITUTE OF TECHNOLOGY
Protection of System Resources
Chapter 9 Alphanumeric Displays
LCD and Keyboard Interfacing
LCD and Keyboard Interfacing
Software Environment ISE 5.x Interaction with simple LCDs
LCD and Keyboard Interfacing
LCD and Keyboard Sepehr Naimi
8051 Micro Controller.
LCD and Keyboard Interfacing
LCD (LIQUID CRISTAL DISPLAY) SCREENS
INTERRUPTS.
Presentation transcript:

Chapter 10 Glass Bliss Using the Parallel Master Port to communicate with Alphanumeric LCD displays

Di Jasio - Programming 32-bit Microcontrollers in C Alphanumeric LCD Modules

Di Jasio - Programming 32-bit Microcontrollers in C InstructionCodeDescription/ Execution time RSR/WDB7DB6DB5DB4DB3DB2DB1DB0 Clear display Clears display and returns cursor to the home position (address 0). 1.64mS Cursor home *Returns cursor to home position (address 0). Also returns display being shifted to the original position. DDRAM contents remains unchanged. 1.64mS Entry mode set I/DSSets cursor move direction (I/D), specifies to shift the display (S). These operations are performed during data read/write.40uS Display On/Off DCBSets On/Off of all display (D), cursor On/Off (C) and blink of cursor position character (B). 40uS Cursor/display shift000001S/CR/L**Sets cursor-move or display-shift (S/C), shift direction (R/L). DDRAM contents remains unchanged. 40uS Function set00001DLNF**Sets interface data length (DL), number of display line (N) and character font(F).40uS Set CGRAM addr0001CGRAM addressSets the CGRAM address. CGRAM data is sent and received after this setting.40uS Set DDRAM addr001DDRAM addressSets the DDRAM address. DDRAM data is sent and received after this setting. 40uS Read busy-flag and address ctr01BFCGRAM / DDRAM addressReads Busy-flag (BF) indicating internal operation is being performed and reads CGRAM or DDRAM address counter contents (depending on previous instruction).0uS Write to CGRAM 10write dataWrites data to CGRAM or DDRAM.40uS (or DDRAM) Read CGRAM 11read dataReads data from CGRAM or DDRAM.40uS (or DDRAM) HD44780 Instruction Set

Di Jasio - Programming 32-bit Microcontrollers in C HD44780 Instruction Set (cont.) Bit nameSetting / Status I/D0 = Decrement cursor position1 = Increment cursor position S0 = No display shift1 = Display shift D0 = Display off1 = Display on C0 = Cursor off1 = Cursor on B0 = Cursor blink off1 = Cursor blink on S/C0 = Move cursor1 = Shift display R/L0 = Shift left1 = Shift right DL0 = 4-bit interface1 = 8-bit interface N0 = 1/8 or 1/11 Duty (1 line)1 = 1/16 Duty (2 lines) F0 = 5x7 dots1 = 5x10 dots BF0 = Can accept instruction1 = Internal operation in progress

Di Jasio - Programming 32-bit Microcontrollers in C Character Generator Table

Di Jasio - Programming 32-bit Microcontrollers in C Parallel Master Port

Di Jasio - Programming 32-bit Microcontrollers in C PMCON PMCON Register 20-1 (DS61143)

Di Jasio - Programming 32-bit Microcontrollers in C LCD Initialization #define LCDDATA 1 // RS = 1 ; access data register #define LCDCMD 0 // RS = 0 ; access command register #define PMDATA PMDIN1 // PMP data buffer void LCDinit( void) { // PMP initialization PMCON = 0x83BF; // Enable the PMP, long waits PMMODE = 0x3FF; // Master Mode 1 PMPEN = 0x0001; // PMA0 enabled PMADDR = LCDCMD; // command register (ADDR = 0) PMDATA = 0x38; // set: 8-bit interface, 2 lines, 5x7 TMR1 = 0; while( TMR1<8); // 8 x 6us = 48us PMDATA = 0x0c; // ON, no cursor, no blink TMR1 = 0; while( TMR1<8); // 8 x 6us = 48us PMDATA = 0x01; // clear display TMR1 = 0; while( TMR1<300);// 300 x 6us = 1.8ms PMDATA = 0x06; // increment cursor, no shift TMR1 = 0; while( TMR1<300); // 300 x 6us = 1.8ms } // LCDinit

Di Jasio - Programming 32-bit Microcontrollers in C Reading the LCD char readLCD( int addr) { int dummy; while( PMMODEbits.BUSY); // wait for PMP to be available PMADDR = addr; // select the command address dummy = PMDATA; // init read cycle, dummy read while( PMMODEbits.BUSY); // wait for PMP to be available return( PMDATA); // read the status register } // readLCD #define busyLCD() readLCD( LCDCMD) & 0x80 #define addrLCD() readLCD( LCDCMD) & 0x7F #define getLCD() readLCD( LCDDATA)

Di Jasio - Programming 32-bit Microcontrollers in C Writing to the LCD void writeLCD( int addr, char c) { while( busyLCD()); while( PMMODEbits.BUSY); // wait for PMP to be available PMADDR = addr; PMDATA = c; } // writeLCD #define busyLCD() readLCD( LCDCMD) & 0x80 #define addrLCD() readLCD( LCDCMD) & 0x7F #define getLCD() readLCD( LCDDATA)

Di Jasio - Programming 32-bit Microcontrollers in C Extending the “Include Search Path”

Di Jasio - Programming 32-bit Microcontrollers in C LCD Control Using the peripheral library void initLCD( void) { // PMP initialization mPMPOpen( PMP_ON | PMP_READ_WRITE_EN | 3, PMP_DATA_BUS_8 | PMP_MODE_MASTER1 | PMP_WAIT_BEG_4 | PMP_WAIT_MID_15 | PMP_WAIT_END_4, 0x0001, // only PMA0 enabled PMP_INT_OFF); // no interrupts used // wait for >30ms Delayms( 30); //initiate the HD44780 display 8-bit init sequence PMPSetAddress( LCDCMD); // select command register PMPMasterWrite( 0x38); // 8-bit int, 2 lines, 5x7 Delayms( 1); // > 48 us PMPMasterWrite( 0x0c); // ON, no cursor, no blink Delayms( 1); // > 48 us PMPMasterWrite( 0x01); // clear display Delayms( 2); // > 1.6ms PMPMasterWrite( 0x06); // increment cursor, no shift Delayms( 2); // > 1.6ms } // initLCD

Di Jasio - Programming 32-bit Microcontrollers in C LCD Control Using the peripheral library char readLCD( int addr) { PMPSetAddress( addr); // select register mPMPMasterReadByte(); // initiate read sequence return mPMPMasterReadByte();// read actual data } // readLCD void writeLCD( int addr, char c) { while( busyLCD()); PMPSetAddress( addr); // select register PMPMasterWrite( c); // initiate write sequence } // writeLCD

Di Jasio - Programming 32-bit Microcontrollers in C putsLCD() void putsLCD( char *s) { char c; while( *s) { switch (*s) { case '\n': // point to second line setLCDC( 0x40); break; case '\r': // home, point to first line setLCDC( 0); break; case '\t': // advance next tab (8) positions c = addrLCD(); while( c & 7) { putLCD( ' '); c++; } if ( c > 15) // if necessary move to second line setLCDC( 0x40); break; default: // print character putLCD( *s); break; } //switch s++; } //while } //putsLCD

Di Jasio - Programming 32-bit Microcontrollers in C Advanced LCD Control #define setLCDG( a) writeLCD( LCDCMD, (a & 0x3F) | 0x40)

Di Jasio - Programming 32-bit Microcontrollers in C Progress Bar void newBarTip( int i, int width) { char bar; int pos; // save cursor position while( busyLCD()); pos = addrLCD(); // generate a new character at position i // set the data pointer to the LCD CGRAM buffer setLCDG( i*8); // as a horizontal bar (0-4)x thick moving left to right // 7 pixel tall if ( width > 4) width = 0; else width = 4 - width; for( bar=0xff; width > 0; width--) bar >= 1; if right to left // fill each row (8) with the same pattern putLCD( bar); // restore cursor position setLCDC( pos); } // newBarTip

Di Jasio - Programming 32-bit Microcontrollers in C Progress Bar (cont.) void drawProgressBar( int index, int imax, int size) { // index is the current progress value // imax is the maximum value // size is the number of character positions available int i; // scale the input values in the available space int width = index * (size*5) / imax; // generate a character to represent the tip newBarTip( TIP, width % 5); // user defined character 0 // draw a bar of solid blocks for ( i=width/5; i>0; i--) putLCD( BRICK); // filled block character // draw the tip of the bar putLCD( TIP); // use character 0 } // drawProgressBar