Johan
- 15th November 2008, 10:28
I tried to display decimal value to LCD, it works.
How to display the value to LCD while sending the value with HSEROUT ?
Everytime I enable the HSEROUT command , the LCD do not display anything , not even the "HELLO" at the beginning
If the HSEROUT line is disabled, the LCD works again
Please take a look at my code below. Thanks
'************************************************* ***************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2008 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 14/11/2008 *
'* Version : 1.0 *
'* Notes : 16F88 20 Mhz *
'* : PBP 2.50b MPASM *
'************************************************* ***************
ASM
__config _CONFIG1, _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_ALL & _CCP1_RB3
__config _CONFIG2, _IESO_OFF & _FCMEN_OFF
endasm
define osc 20
define hser_rcsta 90h
define hser_txsta 20h
define hser_baud 9600
define hser_spbrg 25
DEFINE HSER_CLROERR 1
DEFINE LCD_DREG PORTB ' LCD data port
DEFINE LCD_DBIT 0 ' LCD data starting bit
DEFINE LCD_RSREG PORTA ' LCD register select port
DEFINE LCD_RSBIT 3 ' LCD register select bit
DEFINE LCD_EREG PORTA ' LCD enable port
DEFINE LCD_EBIT 4 ' LCD enable bit
DEFINE LCD_BITS 4 ' LCD data bus size
DEFINE LCD_LINES 2 ' Number lines on LCD
DEFINE LCD_COMMANDUS 2000 ' Command delay time in us
DEFINE LCD_DATAUS 50 ' Data delay time in us
CLEAR
TRISA = %00000000
TRISB = %00000000
ANSEL = %00000000
value var byte
lcdout $FE,1
start:
LCDOUT $FE,1, " Hello"
pause 50
for value = 1 to 255
LCDout $FE,$C0, dec value
pause 50
;hserout [0,dec value] ; IF THIS LINE IS ENABLED, LCD DOESN NOT DISPLAY ANYTHING
pause 50
next value
pause 5000
goto start
How to display the value to LCD while sending the value with HSEROUT ?
Everytime I enable the HSEROUT command , the LCD do not display anything , not even the "HELLO" at the beginning
If the HSEROUT line is disabled, the LCD works again
Please take a look at my code below. Thanks
'************************************************* ***************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2008 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 14/11/2008 *
'* Version : 1.0 *
'* Notes : 16F88 20 Mhz *
'* : PBP 2.50b MPASM *
'************************************************* ***************
ASM
__config _CONFIG1, _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_ALL & _CCP1_RB3
__config _CONFIG2, _IESO_OFF & _FCMEN_OFF
endasm
define osc 20
define hser_rcsta 90h
define hser_txsta 20h
define hser_baud 9600
define hser_spbrg 25
DEFINE HSER_CLROERR 1
DEFINE LCD_DREG PORTB ' LCD data port
DEFINE LCD_DBIT 0 ' LCD data starting bit
DEFINE LCD_RSREG PORTA ' LCD register select port
DEFINE LCD_RSBIT 3 ' LCD register select bit
DEFINE LCD_EREG PORTA ' LCD enable port
DEFINE LCD_EBIT 4 ' LCD enable bit
DEFINE LCD_BITS 4 ' LCD data bus size
DEFINE LCD_LINES 2 ' Number lines on LCD
DEFINE LCD_COMMANDUS 2000 ' Command delay time in us
DEFINE LCD_DATAUS 50 ' Data delay time in us
CLEAR
TRISA = %00000000
TRISB = %00000000
ANSEL = %00000000
value var byte
lcdout $FE,1
start:
LCDOUT $FE,1, " Hello"
pause 50
for value = 1 to 255
LCDout $FE,$C0, dec value
pause 50
;hserout [0,dec value] ; IF THIS LINE IS ENABLED, LCD DOESN NOT DISPLAY ANYTHING
pause 50
next value
pause 5000
goto start