{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

06-LCD - Input Output Input& Output Hardware and...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Input Output Input & Output Hardware and software perspectives on the LCD perspectives on the LCD Calculating execution time Calculating execution time Li Liquid Crystal Display Di HARDWARE PERSPECTIVE LCD interface LCD interface LCD_DATA 4 bits bits MicroBlaze GPIO LCD_E LCD_RS LCD_RW Weak MicroController LCD PANEL LCD Sub-System Signals Signals LCD SIGNAL LCD_RW LCD LCD_RS LCD_E LCD_DATA[0:3] FUNCTION Direction of data transfer. For us, always ‘0’. Register Select: ‘0’=access controller register, ‘1’=transfer data Transfer strobe. All transfers occur when ‘LCD_E’ is ‘1’ is 4-bit nibble data bus Writing Nibble to the LCD Writing a Nibble to the LCD LCD_DATA Reading Writing to the LCD Reading / Writing to the LCD We will only write to the device (RW = 0) LCD LCD GPIO (General (General Purpose Input/Output) Input/Output) LCD_Control (4 bits) LCD_Data (4 bits) bits) (Beginning Spring 2008, the OPB was replaced by the PLB) Reference: on Course Documents: Li Liquid Crystal Display Di SOFTWARE PERSPECTIVE Display Addresses Display Addresses LCD Character Set LCD Character Set LCD Control LCD Control ADDRESS= 0x75280000 0 UNUSED 27 28 E 31 RS RW AD LCD_E LCD_RS LCD_RW ADC_START LCD Data LCD Data ADDRESS= 0x75280008 0 UNUSED 27 28 31 D3 D2 D1 D0 LCD_DATA LCD Controller Commands LCD Controller Commands Gaps Between Commands Gaps Between Commands LCD_DATA LCD_DATA Using the LCD Using the LCD Before using the LCD, you must: using the LCD, you must: Initialize: a sequence of operations dictated by the manufacturer dictated by the manufacturer Customize: set the display up to your liking liking Initialization Sequence Initialization Sequence 1. Wait 15 ms 15 ms 2. Write 0x3, pulse LCD_E high for 24 cycles 3. Wait 4.1 ms 4. Write 0x3, pulse LCD_E high for 24 cycles 5. Wait 100 us 6. Write 0x3, pulse LCD_E high for 24 cycles 7. Wait 40 us 8. Write 0x2, pulse LCD_E high for 24 cycles 9. Wait 40 us Customization Sequence Customization Sequence 1. Function Set = 0x28 (4-bit interface, 2 line) - write 0x2, then write 0x8 2. Entry Mode (auto increment, shift display) Mode (auto increment shift display) 3. Display Set (enable, cursor on/off) 4. Clear Display = 0x01 Precision Delays Precision Delays Illustrative Example Illustrative Example DESCRIPTION: Craft a program that accepts a value in r1 and r4, and returns value in r1 If r1 !=0 r5 should contain upon returns a value in r1. If r1 !=0, r5 should contain upon completion the number of 1s in the value in r4. If r1 == 0, r5 should be the mirror image of the value in r4. Examples: r1=1, r4= 0x00012345 then r5 => 7 r1=0, r4= 0xfa000001 then r5 => 0x8000005f Bit Reversal Part Bit Reversal Part _start: start: addi loop: add src addi bnei done: bri done r4,r4,r4 r5,r5 r6,r6,-1 r6,loop r6,r0,32 How long does this does this take to execute? execute? Machine Code Machine Code Xilinx MicroBlaze GAS Version 2.9.4 bitrev.s page 1 1 2 2 2 2 2 3 4 5 6 7 8 9 10 11 .globl _start .org 0x50 0000 00000000 00000000 00000000 00000000 00000000 0050 20C00020 0054 0058 005c 0060 00842000 90A50021 20C6FFFF BC26FFF4 0064 B8000000 _start: addi loop: add src addi bnei done: bri r6,r0,32 r4,r4,r4 r5,r5 r6,r6,-1 r6,loop done From the From the . Latencies Latencies INSTRUCTION addi add src bnei * bri * * NOTE: CYCLES 1 1 1 1 or 3 or 3 The ‘D’ version would reduce these to 2 cycles Execution Time Execution Time _start: addi loop: add src addi bnei done: bri done ---TOTAL 191 CYCLES OCCUR TOTAL r6,r0,32 r4,r4,r4 r5,r5 r6,r6,-1 r6,loop 1 1 1 1 3 or 1 1 32 32 32 31/1 1 32 32 32 94 NOTE: for a 100MHz clock, this is equal to 1.91us. The Full Solution The Full Solution _start: beqid r1,mirror addi r6,r0,32 add bitcnt: add addic addi bnei bri r5,r0,r0 r5,r0,r0 r4,r4,r4 r5,r5,0 r6,r6,-1 r6 r6,bitcnt done mirror: add r4,r4,r4 src r5,r5 addi r6,r6,-1 bnei r6,mirror done: bri done THE THE END ...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online