Lec10 - EE319K IntroductiontoMicrocontrollers...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
10-1 EE 319K Introduction to Microcontrollers Lecture 10: LCD Programming,  Interrupts, Output Compare Periodic  Interrupts  Read Book Sections 9.1, 9.2, 9.4, 9.6.1, 9.6.2, 9.10
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Ramesh Yerraballi 10-2 LCD Programming
Background image of page 2
Ramesh Yerraballi 10-3 4-bit Interface
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Ramesh Yerraballi 10-4 Operations Clear display ;1)outCsr($01) causes Clear ;2) blind cycle 1.64ms wait ;3)outCsr($02) sends the Cursor to home ;4) blind cycle 1.64ms wait Move cursor to  ;1)outCsr(DDaddr+$80) first row (left-most 8) DDaddr is 0 to 7 second row (right-most 8) DDaddr is $40 to $47
Background image of page 4
Ramesh Yerraballi 10-5 Fonts Define up to 8 new fonts // font is the font number 0 to 7 // n0-n7 is the 5 by 8 pixel map CGaddr=((font&0x07)<<3)+0x40; outCsr(CGaddr); // set CG RAM address LCD_OutChar(n0); LCD_OutChar(n1); LCD_OutChar(n2); LCD_OutChar(n3); LCD_OutChar(n4); LCD_OutChar(n5); LCD_OutChar(n6); LCD_OutChar(n7); outCsr(0x80); // revert back to DD RAM
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Ramesh Yerraballi 10-6 Fonts Example Say we want to store the following  graphic (pixel configuration) in font  number 5  // n0 = $00 // n1 = $11 // █ █ █ █ █ n2 = $1F // n3 = $15 // n4 = $15 // n5 = $15 // █ █ █ n6 = $0E // n7 = $04 // set font=5 to this graphic // CGaddr=((5&0x07)<<3)+0x40 = $68 outCsr(0x68); // set CG RAM address LCD_OutChar(0x00); LCD_OutChar(0x11); LCD_OutChar(0x1F); LCD_OutChar(0x15); LCD_OutChar(0x15); LCD_OutChar(0x15); LCD_OutChar(0x0E); LCD_OutChar(0x04); outCsr(0x80); // revert back to DD RAM // To output this graphic LCD_OutChar(5);
Background image of page 6
Ramesh Yerraballi 10-7 LCD_OutFix 0) save any registers that will be destroyed by pushing on the stack 1) allocate local variables letter and num on the stack 2) initialize num to input parameter, which is the integer part 3) if number is less or equal to 9999, go the step 6 4) output the string “*.*** “ calling LCD_OutString 5) go to step 19 6) perform the division num/1000 , putting the quotient in letter , and the remainder in num 7) convert the ones digit to ASCII, letter = letter+$30 8) output letter to the LCD by calling LCD_OutChar 9) output ‘.’ to the LCD by calling LCD_OutChar 10)perform the division num/100 , putting the quotient in letter , and the remainder in num 11)convert the tenths digit to ASCII, letter = letter+$30 12)output letter to the LCD by calling LCD_OutChar 13)perform the division num/10 , putting the quotient in letter , and the remainder in num 14)convert the hundredths digit to ASCII, letter = letter+$30 15)output letter to the LCD by calling LCD_OutChar 16)convert the thousandths digit to ASCII, letter = num +$30
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/25/2010 for the course EE 319K taught by Professor Bard during the Spring '08 term at University of Texas at Austin.

Page1 / 20

Lec10 - EE319K IntroductiontoMicrocontrollers...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online