Download presentation
Presentation is loading. Please wait.
Published byJamir Morin Modified over 9 years ago
1
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 Character “A” : The “Shift Display” Command : Multiple Data Write Operations: Display “AB”: ROM Based Electronic Billboard System : ROM Based Electronic Billboard System Timing : Viewable DDRAM : Off-Screen DDRAM : DDRAM Cylinder Effect : DMD Sample Program : DMD Custom Characters :
2
DMD Display Command Register ROM Data Commands DMD HELLO Lab 12 : DMD Basics : Dot Matrix Displays with Hitachi HD44780 controller (or DMD) understand various commands and can easily be programmed to display scrolling messages. Many electronic products use this type of display as an electronic billboard to display messages. WORLD HELLO WORLD HELLO WORLD HELL WORL HEL WOR HE WO H W CounterROM The DMD display can be connected to a ROM. The ROM contains the DMD codes. The counter cycles the address bus to send the codes to the display. HELL0 W0RLD HELL0 W0RLD HELL W0RL HEL W0R HE W0 H W DMD Display The DMD accepts 2 types of codes. Data codes (ASCII) and command codes (commands like “Shift Message”). The ROM stores a mix of data and commands which makes up the DMD message. Here is the HELLO WORLD sample program. Initialize the display: Use top line : Auto move cursor. HELLO WORLD Shift the message to the right HELLO WORLD HELLO WORLD HELL WORL HEL WOR HE WO H W Write next data on the bottom line : Slide #2
3
S I O1O0 S Z I0I1 >Clk Command Register Data Registers : Display Data RAM : DDRAM Character Generator ROM : CGROM CGRAM 8 Bit Data Bus 8 Tri-State Buffers 8 Bit Mux/DeMux 000F ERSR/WDB7DB0 Lab 12: Data Write Operation: Character “A”: Display the character “A”: Step 1: the computer sends the code 01000001 to the data bus (DB0…DB7). 01000001 Computer writes code for “A” Step 2: the computer sets R/W (Read Write) to 0. This enables the input buffers and transfers the data bus to MUX. Step 3: the computer sets RS (Register Select) to 1. This selects channel 1 of Mux/DeMux. The Mux passes the data bus to the CGROM. 0 HiZ 1 Step 4: The CGROM retrieves the pixel pattern for character A and gets ready to transfer it to DDRAM. Step 5: The computer provides a clock pulse to the E (enable) input. This clocks the DDRAM registers and completes the write operation. A A ROM can be used to send codes to the DMD. However, the DMD was designed to work with a computer system. Let’s look at the computer interface A Slide #3
4
Lab 12: Shift Display Command: Shift Display Right : Step 1: the computer sends the code 00011100 to the data bus (DB0…DB7). 00011100 Computer writes “Shift Display Right” command Step 2: the computer sets R/W (Read Write) to 0. This enables the input buffers and transfers the data bus to MUX. Step 3: the computer sets RS (Register Select) to 0. This selects channel 0 of Mux/DeMux. The Mux passes the data bus to the Command Register. 0 HiZ 0 Step 4: The computer provides a clock pulse to the E (enable) input. This clock the Command Register and transfers the command. S I O1O0 S Z I0I1 >Clk Command Register Data Registers : Display Data RAM : DDRAM Character Generator ROM : CGROM CGRAM 8 Bit Data Bus 8 Tri-State Buffers 8 Bit Mux/DeMux 000F ERSR/WDB7DB0 A Let’s assume that the character “A” has been written and is being displayed. We would like to shift the character one position to the right. The DMD has a “Shift Display Right” command. 00011100 Step 5: The DMD displays executes the shift command. A Slide #4
5
S I O1O0 S Z I0I1 >Clk Command Register Data Registers : Display Data RAM : DDRAM Character Generator ROM : CGROM CGRAM 8 Bit Data Bus 8 Tri-State Buffers 8 Bit Mux/DeMux 000F ERSR/WDB7DB0 Lab 12: Multiple Data Write Operations: Display “AB”: Display the character “A”: Here are all the steps… When a computer needs to display a message (more than one character) it must send several data characters one after the other. The computer must give the DMD display enough time to finish one data write operation before it can start another. 01000001 Computer writes code for “A” 0 HiZ 1 A A Display the character “B”: Before the “B” character can be displayed the computer must wait until the DMD finishes displaying the letter “A”. The computer must read the DMD Busy Flag (BF). BF=1 means DMD is busy and not ready for a new data write operation. Here are all the steps… 01 HiZ 10000000 10000000 Computer reads the Busy Flag BF A IF BF=1 then the computer must repeat the BF read operation until it finds BF=0. At this time it can proceed with the data write operation of character “B”. 01000010 Computer writes code for “B” 0 HiZ 1 B B Slide #5
6
CounterROM DMD Display Lab 12: ROM Based Electronic Billboard System The DMD display was designed to be used with a computer system. The computer writes data/command codes and then reads the Busy Flag to see if the DMD is ready for the next write operation. A ROM based system can write data and command codes but it cannot read the Busy Flag! To make a ROM based system work it is necessary that the DMD be given enough time to complete a write operation before beginning the next write operation. According to the Hitachi data sheets the slowest write operation takes 1.64 milliseconds. Many other DMD operations execute in microseconds. The ROM based electronic billboard system uses a clock with a clock rate of 12 PPS (or a period of 83 milliseconds). This means that the ROM sends out the code for one write operation and then waits 83 milliseconds to send out the code for the next write operation. At this transfer rate it is NOT necessary to read the Busy Flag and the system works error free! The only disadvantage is that you cannot go any faster than 83 milliseconds per transfer. A computer, on the other hand, can speed up the transfers whenever necessary. This can be useful to give the illusion that an entire word (several characters) can appear on the display at once (instead of 1 character at a time). A computer has more control over the display than a ROM based electronic billboard system. A computer based electronic billboard system is like a car with a variable gas pedal in it. It can go fast or slow whenever necessary. AB 83 milliseconds later Slide #6
7
Lab 12: ROM Based Electronic Billboard System Timing: ROM Data Command Register DB0DB1DB2DB3DB4DB5DB6DB7 >Ck ERS Command RS=1 RS=0 R/W 256X9 Q8 Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 A1 A2 A3 A4 A5 A6 A7 A0 Q20 Q21 Q22 Q23 Q24 Q25 Q26 Q27 Q28 Q29 Q32 Q19 Q0 >Clk 25.175 Meg PPS Counter R/W of DMD: The ROM cannot read the Busy Flag. The read mode is not required. Q8 of ROM: Q8=1 for data write and Q8=0 for command write. Q20 of Counter: DMD E requires a negative edge to complete a write operation. Q20 frequency = 25.175 Meg PPS/2 21 = 12.004 PPS Q20 period= 1/12.004 = 83 milliSec. Q20 Q21 Q22 Q28 Counter timing diagram. The counter changes the address of the ROM at every negative edge of Q20 Old 8 bit addressNew 8 bit address The ROM also changes the data bus at each negative edge of Q20. When the data bus is changing you should NOT clock the DMD (input E). The inverter ensures the DMD is not clocked when the data bus is changing. Here is how it works… NewOld The positive edge on Q20 passes through the inverter and becomes a negative edge which clocks the DMD. The DMD is clocked when address and data bus are stable (in the middle of the yellow zone). Slide #7
8
Lab 12: Viewable DDRAM : DDRAM (Display Data RAM) is the memory which stores the data that is viewed by the user of the DMD. It displays 2 lines of 16 characters. It also has 24 off-screen characters. The off-screen character will be explained later. Data Command Register DB0DB1DB2DB3DB4DB5DB6DB7 >Ck ERS Command RS=1 RS=0 R/W Each character position is assigned an address. Line 1 (top) addresses begin at 00 HEX and ends at 27 HEX. Line 2 (bottom) addresses begin at 40 HEX and ends at 67 HEX. The addresses are in hex and can easily be converted to binary if you remember: 1 hex numeral = 4 bit binary. Viewable : 16 CharactersOff-Screen : 24 Characters 000102030405060708090A0B0C0D0E0F1011121324252627 404142434445464748494A4B4C4D4E4F5051525364656667 To display the word “Hello” in the middle of line 1 you would write the command “Set DDRAM address =05H” and then write the data characters “Hello”. DDRAM Add=05 Hello To display the word “World” in the middle of line 2 you would write the command “Set DDRAM address =45H” and then write the data characters “World”. DDRAM Add=45 World Slide #8
9
Viewable : 16 Characters 000102030405060708090A0B0C0D0E0F1011121314151617 404142434445464748494A4B4C4D4E4F5051525354555657 Off-Screen : Lab 12: Off-Screen DDRAM : The off-screen DDRAM characters can be used to store display data and then later scroll it into view. It is like a holding area for messages. While the user pauses to read the on-screen message the delay can be used to write off-screen. Data Command Register DB0DB1DB2DB3DB4DB5DB6DB7 >Ck ERS Command RS=1 RS=0 R/W DDRAM Add=00 Hello DDRAM Add=40 orld Write the message “Hello World” in the viewable area of the DMD display. Write the message “Good Day” off-screen. DDRAM Add=10 Good DDRAM Add=50 Day The user will see the message “Hello World” and it will seem like the system has paused. The pause is actually the time taken to write “Good Day” off-screen. The “Shift Display Left” command will be used to move the “Good Day” message into view while scrolling “Hello World” out of view. Shift Display Left W Viewable : 16 Characters Shift Display Left Viewable : 16 Characters Shift Display Left Viewable : 16 Characters Shift Display Left Viewable : 16 Characters Shift Display Left Viewable : 16 Characters Shift Display Left Viewable : 16 Characters 000102030405060708090A0B0C0D0E0F1011121314151617 404142434445464748494A4B4C4D4E4F5051525354555657 Hello orld Good DayW Off-Screen The “Shift Display Left” command moves the message left one character position. Five “Shift Display Left” commands are needed to move “Hello World” off screen. The “Shift Display Left” command moves the message to the left but actually moves the Viewable Window to the right. To make the message “Hello World” re-appear you would need to use 5 “Shift Display Right” commands. Slide #9
10
01 02 03 040506 07 08 09 41 42 43444546 47 48 49 02 03 04 050607 08 09 42 4344 45464748 49 0A 4A 0B03 04 05 060708 09 4B43 4445 46474849 0A 4A 0B 0C04 05 06 070809 4B 4C44 4546 474849 0A 4A Viewable : 16 CharactersOff-Screen : 24 Characters 000102030405060708090A0B0C0D0E0F1011121324252627 404142434445464748494A4B4C4D4E4F5051525364656667 Lab 12: DDRAM Cylinder Effect: DDRAM memory is laid out like a cylinder. Cut out the entire rectangle representing DDRAM and fold it back into a loop. 00 01 02 030405 06 07 08 40 41 42434445 46 47 48 Spin the cylinder and you can see more DDRAM addresses. 00 01 02 030405 06 07 08 40 41 42434445 46 47 48 0B 0C04 05 06 070809 4B 4C44 4546 474849 0A 4A Spin it more and eventually you reach the last address 27 and 67. GoodDay G o od D a y 27 and 67 are actually next to 00 and 40 in memory. This means if you write a message off screen at the end of the first line it is next to a message written at address 00. The “Shift Display Right” command can bring both messages into view. Viewable Characters! 03 0424 25 26 270001 43 4464 65 66674041 02 42 Slide #10
11
ROM Data Command Register DB0DB1DB2DB3DB4DB5DB6DB7 >Ck ERS Command RS=1 RS=0 R/W Q8 Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 A1 A2 A3 A4 A5 A6 A7 A0 Q20 Q21 Q22 Q23 Q24 Q25 Q26 Q27 Q28 Q29 Q32 Q19 Q0 >Clk 25.175 Meg PPS Counter Lab 12: DMD Sample Program : The ROM will be loaded with a “Sample Program”. Sample Program Address 0 Address 8 The counter will start at 0 and cycle forward. Each new count state generates a new address for the ROM and a new code is written to the DMD display. From DMD command Summary Sheet in Chapter 12. 0 0 0 0 0 0 0 00 0 0 0 1 1 1 0 00 0 0011 1000 (38) Set Display Mode (Display Function) DL sets the Data Bus size. N sets the number of lines to be used. F sets the Dot Matrix Font. (1 st command) 0010 * * F NDL 000111000038 DL = 1 : Use an 8 bit Data Bus. N = 1 : Use 2 lines of the display F =0 : 5x7 Dot Matrix Font. 1 0 0 0 0 0 0 00 0 0 0 0 0 0 0 00 1 0000 0001 (01) 000000001001 Clear Display 000010000Clears display and returns cursor to home position (DDRAM address = 00H). 0 1 0 0 0 0 0 00 0 0 0 0 0 0 1 1 0 0000 0110 (06) 000000110006 Set the data write mode 0000001I/DS I/D sets the CURSOR/DISPLAY move direction. The CURSOR/DISPLAY will automatically move to the next DDRAM/CGRAM address after each data write. S specifies to shift the display or to move the cursor. I/D = 1 : Increment the DDRAM address S = 0 : Move the cursor after data write. Display Freeze 1 1 0 0 0 0 0 00 0 0 0 0 0 1 1 0 0 0000 1100 (0C) 00000110000C D = 1 : Turn the entire display ON. C = 0 : Turn the cursor OFF Set Display/Cursor On/Off D sets display On/Off. C sets cursor On/Off. B enables the character at the cursor position to Blink/Not Blink. 0000BCD10 B= 0 :DO NOT Blink the character at the cursor position 0 0 1 0 0 0 0 00 0 1 1 0 0 0 0 0 0 1100 0000 (C0) 0110000000C0 100 0000 = 40 Hex (Line 2, first position) Set DDRAM Address Sets the starting DDRAM address. The DDRAM ASCII/Jap/Custom characters are sent to this starting address after this setting. 01ADD (7 bit address) 1 0 1 0 0 0 0 00 1 0 1 0 1 0 1 0 0 T 101010100154 0101 0100 = 54 Hex = “T” (see the CGROM table) 8 bit code for ASCII/JAP/Custom Characters CGRAM/DDRAM Data Write Writes data into DDRAM or CGRAM. Used after address has been set. The address pointer is inc/dec automatically. 1 0 1 1 0 0 0 0 00 1 0 1 1 0 0 1 0 1 T 101100101165 0110 0101 = 65 Hex = “e” (see the CGROM table) 8 bit code for ASCII/JAP/Custom Characters CGRAM/DDRAM Data Write Writes data into DDRAM or CGRAM. Used after address has been set. The address pointer is inc/dec automatically. 1 e 1 1 1 0 0 0 0 00 1 0 1 1 1 0 0 1 1 T 101110011173 0111 0011 = 73 Hex = “s” (see the CGROM table) 8 bit code for ASCII/JAP/Custom Characters CGRAM/DDRAM Data Write Writes data into DDRAM or CGRAM. Used after address has been set. The address pointer is inc/dec automatically. 1 es 0 0 0 1 0 0 0 00 1 0 1 1 1 0 1 0 0 T 101110100174 0111 0100 = 74 Hex = “t” (see the CGROM table) 8 bit code for ASCII/JAP/Custom Characters CGRAM/DDRAM Data Write Writes data into DDRAM or CGRAM. Used after address has been set. The address pointer is inc/dec automatically. 1 est 038 001 006 00C 0C0 154 165 173 174 Command Register The first 5 codes in ROM (begin with 0xx) are DMD commands they are needed to initialize the display. While these codes are being executed the user will see nothing appear on the display. This initialization sequence is necessary and must be done before the message can be displayed. The last four codes in ROM (begin with 1xx) are ASCII data. They spell out the test message. Slide #11
12
Data Command Register DB0DB1DB2DB3DB4DB5DB6DB7 >Ck ERS Command RS=1 RS=0 R/W CGRAM-3DDRAM 100000000 5 Pixels 001011000 Lab 12: DMD Custom Characters : Custom characters are user defined. DMD displays have 8 custom characters. A custom character is initialized once and then accessed as many times as necessary. A happy face character will be created and displayed. Step 1: The face will be saved into CGRAM-3. Use the “CGRAM Address Set” command to inform the DMD display that the next data transfers are pixel layouts that belong in CGRAM. This command prevents the DMD from transferring the data to DDRAM as ASCII data. CGRAM Address Set = 058 = 01 01 1000 (6 bit address is 18 hex for CG3). 01 01 1000 Set CGRAM-3 Step 2: Use data write operations to fill in the pixel layout of the happy face. Remember each row is made up of 5 dots(pixels). The character is made up of 7 rows (+ 1 cursor row) of 5 pixels. It will take 8 data write operations to define the face. Remember data writes now go to CGRAM. Logic 0 = pixel off Logic 1 = pixel on 100001010100000000 Step 3: To access the character you must issue a DDRAM Address Set command. This will cause subsequent data transfers to be sent to DDRAM and stop data transfers to CGRAM. The face character can be accessed at address 03 (see chapter 12 for details). We will display it on the bottom line. 1 100 0000 DDRAM add. =40 100000011 100000100100010001100001110100000000 100000000Cursor row 011000000 ROM 058 100 10A 100 104 111 10E 100 0C0 103 Slide #12
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.