'---------------Title-------------- ' File......16F877A_LCD1.pbp ' Started....3/18/06 ' Microcontroller used: Microchip Technology PIC16F877A ' microchip.com ' PicBasic Pro Code: micro-Engineering Labs, Inc. ' melabs.com '--------Program Desciption-------- ' Prints simple message to 16 x 2 parallel ' LCD which uses Hitachi 44780 controller. ' Most hobby LCD's use this controller. '----------Related Lessons--------- ' See LCD BASICS lesson at: ' http://cornerstonerobotics.org/curriculum/lessons_year2/erii14_lcd1.pdf ' ' lcd1.pbp (the 16F88 program) is used in ' the lesson LCD Command Control Codes at: ' http://cornerstonerobotics.org/curriculum/lessons_year2/erii15_lcd2_lcd_command_control_codes.pdf '------------Comments-------------- ' A practical guide to interfacing and ' programming LCD modules can be found at ' www.epemag.wimborne.co.uk/resourses.htm ' or by googling everyday practical electronics lcd ' The article includes LCD pin functions. '-----New PicBasic Pro Command----- ' The PicBasic Pro Compiler Manual is on line at: ' http://www.microengineeringlabs.com/resources/index.htm#Manuals ' ' LCDOUT Item{,Item...} ' Display Item on an intelligent Liquid Crystal Display. PBP ' supports LCD modules with a Hitachi 44780 controller or ' equivalent. ' Look around page 95 in the PicBasic Pro Compiler Manual '----------PIC Connections--------- ' See schematic at: ' http://www.cornerstonerobotics.org/schematics/pic16f877a_lcd1_lcd2.pdf ' 16F88 Pin Wiring ' --------- ---------- ' RA0 LCD pin 11(DB4) ' RA1 LCD pin 12(DB5) ' RA2 LCD pin 13(DB6) ' RA3 LCD pin 14(DB7) ' RA4 LCD Register Select(RS) ' RB3 LCD Enable(E) ' See schematic for the other usual PIC connections '----------LCD Connections--------- ' LCD Pin Wiring ' --------- ---------- ' 1 Ground(Vss) ' 2 + 5v(Vdd) ' 3 Center of 20K Pot(Contrast) ' 4 RA4(Register Select,RS) ' 5 Ground(Read/Write,R/W) ' 6 RB3(Enable) ' 7 No Connection(DB0) ' 8 No Connection(DB1) ' 9 No Connection(DB2) ' 10 No Connection(DB3) ' 11 RA0(DB4) ' 12 RA1(DB5) ' 13 RA2(DB6) ' 14 RA3(DB7) '----------Revision History-------- ' 11/28/07 Change MCU from 16F84A to 16F88 ' 11/28/07 Add 16F88 oscillator and ANSEL = 0 ' initializations ' 1/2/09 Change MCU from 16F88 to 16F877A ' 1/2/09 Delete ANSEL = 0 and add ADCON1 initialization '----------Initialization---------- ADCON1 = %00000110 ' Changes PORTE and PORTA analog bits to ' digital operation since not using ADC ' (Analog to Digital Converter) ' For the ADCON1 Register table, look at the ' PIC16F877A datasheet. For Microchip PIC datasheets: ' http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2046 ' Select 8-bit PIC Microcontrollers, then the device from the ' drop down menu. Now download the 16F87XA Datasheet. ' The ADCON1 Register is Register 11-2: ADCON1 Register, ' look around page 128 in the 16F877A datasheet. '------------Main Code------------- pause 1000 ' Pause to allow LCD to setup start: lcdout $FE,1,"Hello World" ' $FE,1 clears the LCD display, ' LCD then displays "Hello World" pause 500 ' Pause 1/2 second goto start ' Go to loop label end