BLUEBILL
- 12th April 2011, 18:28
HI ALL. WONDERING IF ANYONE HAS EXPERIENCE WITH 16F886 AND LCD OUT. I'M USEING A LUMEX LCD PART NUMBER LCM S01602DTR/A.
MY CODE IS..
'*************
'************************************************* ***************
'Configuration Bits
@ __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
@ __config _CONFIG2, _WRT_OFF
OSCCON = $71 'SET OSCILTOR TO INTERNAL 8 MHZ
DEFINE OSC 8
'------------------------------------------------------------------------------
'_________________________________________________ ____________________________
'INITIALIZE PORTS
'PORT A
ANSEL = 0 'PORT A DIGITAL
TRISA = %11111111 'PORT A ALL INPUT
'PORT B
ANSELH = %00000000 'PORT B DIGITAL
TRISB = %00000000 'PORT ALL OUTPUT
IOCB.0 = 0
CCP1CON = %00000000
'PORT C OUTPUTS
TRISC = %00001111 'PORTC 0-3 INPUT 4-7 OUTPUTS
'_________________________________________________ ___________________________
'SET LCD PARAMETERS
DEFINE LCD_DREG PORTB 'SET LCD DATA PORT
DEFINE LCD_DBIT 0 'SET STARTING LCD DATA BIT
DEFINE LCD_RSREG PORTB 'SET LCD REGISTER SELECT PORT
DEFINE LCD_RSBIT 4 'SET LCD REGISTER SELECT BIT
DEFINE LCD_EREG PORTB 'SET LCD ENABLE PORT
DEFINE LCD_EBIT 5 'SET LCD ENABLE BIT
define LCD_BITS 4 'SET TO 4 BIT
DEFINE LCD_LINES 2 'SET NUMBER OF LINES ON LCD
DEFINE LCD_COMMANDUS 1500 'SET COMMAND DELAY TIME IN US
DEFINE LCD_DATAUS 44 'SET DATA DELAY TIME IN US
'_________________________________________________ ____________________________
'DECLARE ALIAS'S
LED VAR PORTC.4 'LED on a 330 High is on
'_________________________________________________ ____________________________
'_________________________________________________ ____________________________
pause 1000
LCDOUT $FE,1
pause 1000
AGAIN:
LCDOUT $FE,1,"TO PLAYER"
LCDOUT $FE,$C0, "FROM PLAYER"
high led
pause 1000
low led
pause 1000
goto again
end
'''''''''''''
I'M CONCERNED THAT I MAY HAVE MISSED A REGISTER SETUP ON PORT B.
ANY INPUT WOULD BE APRECIATED.
THANKS,
BILL
MY CODE IS..
'*************
'************************************************* ***************
'Configuration Bits
@ __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
@ __config _CONFIG2, _WRT_OFF
OSCCON = $71 'SET OSCILTOR TO INTERNAL 8 MHZ
DEFINE OSC 8
'------------------------------------------------------------------------------
'_________________________________________________ ____________________________
'INITIALIZE PORTS
'PORT A
ANSEL = 0 'PORT A DIGITAL
TRISA = %11111111 'PORT A ALL INPUT
'PORT B
ANSELH = %00000000 'PORT B DIGITAL
TRISB = %00000000 'PORT ALL OUTPUT
IOCB.0 = 0
CCP1CON = %00000000
'PORT C OUTPUTS
TRISC = %00001111 'PORTC 0-3 INPUT 4-7 OUTPUTS
'_________________________________________________ ___________________________
'SET LCD PARAMETERS
DEFINE LCD_DREG PORTB 'SET LCD DATA PORT
DEFINE LCD_DBIT 0 'SET STARTING LCD DATA BIT
DEFINE LCD_RSREG PORTB 'SET LCD REGISTER SELECT PORT
DEFINE LCD_RSBIT 4 'SET LCD REGISTER SELECT BIT
DEFINE LCD_EREG PORTB 'SET LCD ENABLE PORT
DEFINE LCD_EBIT 5 'SET LCD ENABLE BIT
define LCD_BITS 4 'SET TO 4 BIT
DEFINE LCD_LINES 2 'SET NUMBER OF LINES ON LCD
DEFINE LCD_COMMANDUS 1500 'SET COMMAND DELAY TIME IN US
DEFINE LCD_DATAUS 44 'SET DATA DELAY TIME IN US
'_________________________________________________ ____________________________
'DECLARE ALIAS'S
LED VAR PORTC.4 'LED on a 330 High is on
'_________________________________________________ ____________________________
'_________________________________________________ ____________________________
pause 1000
LCDOUT $FE,1
pause 1000
AGAIN:
LCDOUT $FE,1,"TO PLAYER"
LCDOUT $FE,$C0, "FROM PLAYER"
high led
pause 1000
low led
pause 1000
goto again
end
'''''''''''''
I'M CONCERNED THAT I MAY HAVE MISSED A REGISTER SETUP ON PORT B.
ANY INPUT WOULD BE APRECIATED.
THANKS,
BILL