Hi,
I have enabled USART interrupt.
I want to reading keyboard and when you push a key the number shuld show on lcd.
after coming interrupt the USART interrupt,the serial information should shoe on lcd for 4 second and led that connected to PORTA.1 should on for 4 second.
lcd is not working but LED is turned on for 4 second.
and also the reading keyboard program doesn't work and with pushing any key you can't see anything on lcd
when i enable USART interrupt it works on pin that i use fr reciving serial dada in serin instruction.
couldyou help me with this problem?
this is my program:
define OSC 4
include"modedefs.bas"
' Set LCD Data port
DEFINE LCD_DREG PORTC
' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_DBIT 4
' Set LCD Register Select port
DEFINE LCD_RSREG PORTC
' Set LCD Register Select bit
DEFINE LCD_RSBIT 1
' Set LCD Enable port
DEFINE LCD_EREG PORTC
' Set LCD Enable bit
DEFINE LCD_EBIT 0
' Set LCD bus size (4 or 8 bits)
DEFINE LCD_BITS 4
' Set number of lines on LCD
DEFINE LCD_LINES 2
pause 100
lcdout $fe,1
i var word
y1 var word
y2 var word
y3 var word
ADCON1=7
TRISA=0
PORTA.1=0
start:
on interrupt goto int
'OPTION_REG = %10000000
INTCON = %11000000
PIE1= %00100000
RCSTA= %11010000
TRISB = %00001111
portb.5=1
if portb.1=1 then
lcdout $fe,1,"1"
call delay
endif
if portb.2=1 then
lcdout $fe,1,"4"
call delay
endif
if portb.3=1 then
lcdout $fe,1,"7"
call delay
endif
if portb.4=1 then
lcdout $fe,1,"prog"
call delay
endif
portb.5=0
portb.6=1
if portb.1=1 then
lcdout $fe,1,"2"
call delay
endif
if portb.2=1 then
lcdout $fe,1,"5"
call delay
endif
if portb.3=1 then
lcdout $fe,1,"8"
call delay
endif
if portb.4=1 then
lcdout $fe,1,"0"
call delay
endif
portb.6=0
portb.7=1
if portb.1=1 then
lcdout $fe,1,"3"
call delay
endif
if portb.2=1 then
lcdout $fe,1,"6"
call delay
endif
if portb.3=1 then
lcdout $fe,1,"9"
call delay
endif
if portb.4=1 then
lcdout $fe,1,"mode"
call delay
endif
portb.7=0
goto start
disable
int:
serin PORTA.5,N1200,["A"],y1
serin PORTA.5,N1200,["A"],y2
serin PORTA.5,N1200,["A"],y3
'
if (y2=y3) then
lcdout $fe,1,#y2
pause 4000
lcdout $fe,1
PORTA.1=1
pause 4000
PORTA.1=0
endif
INTCON = %11000000
PIE1= %00100000
'RCSTA= %11010000
resume
enable
end
delay:
for i=1 to 400
pause 1
next i
return