I figured this would be a good way to get back into the swing of things. I've had this X1 for years and still kept on using breadboards for all testing.
Lab X1 jumpers:
JP1=n/a (unused)
JP2=2-3 (up)
JP3=2-3 (up)
A=1-2 (down)
B=1-2 (down)
C=2-3 (up)
These examples are essentially for beginners and serve only as a starting point. I try not to assume anything and hope to include everything you need to have your program start on the 1st try.
Code:
'*****************************************************************
'* Name : LAB X1 LCD.BAS Version : 1.0 *
'* Author : Demon Date : 2012-01-06 *
'* Task : Display 2 lines of text *
'* Hardware : PIC 16F877, 20mhz crystal *
'* : Lab X1 Experimental Board *
'* : MeLabs U2 Programmer v4.32 *
'* Software : PIC Basic Pro v2.60C *
'* : MicroCode Studio Plus v2.2.1.1 *
'* : MeLabs PM Assembler *
'*****************************************************************
'define LOADER_USED 1
@ DEVICE PIC16F877, HS_OSC, WDT_OFF, PWRT_ON, BOD_ON, LVP_OFF, CPD_OFF, WRT_OFF, DEBUG_OFF, PROTECT_OFF
define OSC 20
DEFINE LCD_DREG PORTD ' Set LCD data port
DEFINE LCD_DBIT 0 ' Set starting data bit
DEFINE LCD_RSREG PORTE ' Set LCD register select port
DEFINE LCD_RSBIT 0 ' Set LCD register select bit
DEFINE LCD_EREG PORTE ' Set LCD enable port
DEFINE LCD_EBIT 1 ' Set LCD enable bit
DEFINE LCD_BITS 8 ' Set LCD bus size
DEFINE LCD_LINES 2 ' Set number of lines on LCD
define LCD_COMMANDUS 2000 ' Set command delay time in microseconds
DEFINE LCD_DATAUS 50 ' Set data delay time in microseconds
TRISD = %00000000 ' Set all port D pins to output
TRISE = %00000000 ' Set all port E pins to output
ADCON1 = 7 ' A/D off, all digital
PAUSE 1000 ' Wait for LCD to initalize
LCDOUT $FE,1,"LAB X1 LCD"
LCDOUT $FE,$C0,"PIC 16F877"
end
Robert
Bookmarks