, Do you have this in C? Thanks, rich! On 10/23/2015 1:47 AM, IVP wrote: > Richard, > > I have just one 4550 project with an LCD. The PIC runs at > > CONFIG FOSC=3D XTPLL_XT ;47.18592MHz =3D 12 * 3.93216 > > Below is some code. I *believe* all the relevant registers are there > > Joe > > -------------------------- > > org 0x100 > > init mov b'00000000',osccon > ; 00 primary > > mov b'11111111',trisa > ; 1 n/a > ; 1 OSC2 > ; 1 spare > ; 1 1111 analogue > > mov b'11111111',trisb > ; 111 buttons > ; 11111 analogue > > mov b'01000000',trisc > ; 0 spare > ; 1 Tx > ; 00 > ; 0 n/a > ; 000 spare > > mov b'00001100',trisd > ; 0000 LCD data > ; 11 switches > ; 00 spare > > mov b'00001111',trise > ; 1 /mclr > ; 111 analogue > > mov b'00001110',adcon1 > ; 0 Vref- =3D Vss > ; 0 Vref+ =3D Vdd > ; 1110 AN0 selected > > clrf intcon > movlw b'10000000' ;pull-ups off > movwf intcon2 > clrf intcon3 > clrf t0con > clrf t1con > clrf wdtcon > > mov b'00000111',cmcon > mov b'00000000',cvrcon > mov b'00000000',sspcon1 > mov b'00000000',adcon0 > ; 0000 AN0 selected > ; 0 Go/Done > ; 0 ADC module off > > mov b'10111110',adcon2 > ; 1 right-justified result > ; 111 20 Tad > ; 110 Tad =3D Fosc/64 > > clrf porta > clrf portb > clrf portc > clrf portd > clrf porte > clrf lata > clrf latb > clrf latc > clrf latd > clrf late > > mov b'000001000',t0con > ; 0 t0 off > ; 0 16-bit > ; 0 internal clock > ; x > ; 1 no pre-scaler > ; xxx > > mov b'000010000',t1con > ; 0 8-bit R/W > ; 0 internal clock > ; 01 pre-scaler > ; 0 T1OSC off > ; 0 no synch > ; 0 internal clock > ; 0 TMR1 off > > init_lcd call lcd_init > > ;=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > ; LCD commands > ;=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > line1 movlw 0x00 ;line 1, column 0 > call address > return > > line2 movlw 0x40 ;line 2, column 0 > call address > return > > address addlw 0x80 ;set high bit of address command > call write_c > return > > write_c bcf rs ;write command > bra d_out > > write_d bsf rs ;write data > > ;LCD data - latd <4:7> > > ;Move MSN of data to MSN of PortD, preserve LSN of PortD > > d_out movwf temp1 ;save data > movfw portd ;read port > andlw b'00001111' ;clear MSN, preserve LSN > movwf shadowd ;store PortD 0000LSN > movfw temp1 ;get MSN of data > andlw b'11110000' ;clear unwanted LSN > addwf shadowd,w ;add data MSN as shadowd MSN > movwf latd ;write to port > usec > bsf en > usec > bcf en > usec > > ;Move LSN of data to MSN of PortD, preserve LSN of PortD > > movfw portd ;read port > andlw b'00001111' ;clear MSN, preserve LSN > movwf shadowd ;store PortD 0000LSN > swapf temp1,w ;swap display data MSN and LSN > andlw b'11110000' ;clear unwanted LSN (old MSN) > addwf shadowd,w ;add data LSN as shadowd MSN > movwf latd ;write to port > usec > bsf en > usec > bcf en > usec > bcf rs > > call us100 > return > > ;=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > ; Initialise LCD screen > ;=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > lcd_init call ms100 > call ms100 > bcf rs > usec > > call write30 > call msdelay ;delay > 4.1ms > call msdelay > call msdelay > call msdelay > call msdelay > > call write30 > call msdelay ;delay > 100us > > call write30 > call msdelay ;delay > 100us > > movlw b'00100000' ;20 > call write_c > movlw b'00001000' ;08 > call write_c > movlw b'00001100' ;0c > call write_c > movlw b'00000110' ;06 > call write_c > call ms100 > return > > write30 movfw portd > andlw b'00001111' > addlw b'00110000' > movwf latd > usec > bsf en > usec > bcf en > usec > > return > > > > ----- > No virus found in this message. > Checked by AVG - www.avg.com > Version: 2015.0.6173 / Virus Database: 4450/10871 - Release Date: 10/22/1= 5 > -- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .