1 / 9

PIC and LCD

PIC and LCD. LCD: Liquid Crystal Device. Registers and memories. CGROM Character Generator ROM

grady
Download Presentation

PIC and LCD

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PIC and LCD LCD: Liquid Crystal Device

  2. Registers and memories CGROM Character Generator ROM Consist of the fix implemented character set (ROM).Character set may differ with different ROM Codes.To display a char, the CGROM address of the character to be showed at the current DDRAM address has to be transmitted to the display. CGRAM Character Generator RAMThe user-defined character set.With 5x7 dots, 8 character patterns can be written and with 5x10 dots, 4 types can be written. Also reprogrammable during use.To display a char, the CGRAM address of the character to be showed at the current DDRAM address has to be transmitted to the display. DDRAM Display Data RAMHere is the data stored, which is currently showed on the display (memory mapped I/O). Registers: • Data register (RS=1) data goes to DDRAM • Command register (RS=0) (Program the LCD)

  3. LCD- Pins

  4. PIC- Program • Power ON • Wait 15 ms • Send 0x30 ;or 38 • Wait 6 ms • Send 0x30 • Wait 6 ms • Send 0x30 • Wait 6 ms • Send %b 0011NFxx • Wait 6 ms • Send %b 00001000 • Wait 6 ms • Send %b 00000001 • Wait 6 ms • Send %b 000001 I/D S Program…. Notes: Make function for command Make function for Display Make initialization function Call functions…. Examples

  5. Some related LCD functions Others: movlw 0x80 ; line 1 call LCDins movlw 0xc0 ; line 2 call LCDins To display something: movlw 0x35 (an examp) call lcdout Control movlw 38h ; display initialisation call LCDins ; output to display movlw 38h ; page 45 of the data sheet call LCDins ; output to display movlw 38h ; two line call LCDins ; output to display movlw .6 ; increment display Call LCDins ; output to display movlw 0ch ; display = on, cursor = off call LCDins ; output to display movlw .1 ; clear display call LCDins ; output to display return

  6. Some related LCD functions LCDins movwf PORTB bcf PORTA, lcdRS call Clock bsf PORTA,lcdE call Clock bcf PORTA,lcdE clrf DelayL movlw 8h movwf DelayH ctlp1 decfsz DelayL goto ctlp1 decfsz DelayH goto ctlp1 return Congiguration of pins lcdRS equ 2 ; RA2 = LCD RS pin lcdE equ 3 ; RA3 = LCD E pin CBLOCK 0x20 ; DelayL DelayM DelayH Temp ; ENDC LCDout movwf PORTB bsf PORTA, lcdRS call Clock bsf PORTA, lcdE call Clock bcf PORTA, lcdE call Clock bcf PORTA, lcdRS

  7. Exercises • Write a program which can display “FORTH YEAR “ on the LCD, second line, middle • Write a program which can display the data in the register W, in decimal form.

More Related