Hi,
I want to read keyboard and show the numbers on lcd by pushing any number and also i want to recieve
serial data from an RF module so i have to enable interrupt.
How can i do it?
i use a PIC16F873A.
i have written a program that you can see here .i think i have problem with my program.
could youb help me with this?
i use micro code studio picbasic pro2.41
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
start:
on interrupt goto int
INTCON = %11000000
PIE1= %00100000
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.0,N1200,["A"],y1
serin PORTA.0,N1200,["A"],y2
serin PORTA.0,N1200,["A"],y3
'
if (y2=y3) then
lcdout $fe,1,#y2
pause 4000
lcdout $fe,1
pause 4000
endif
INTCON = %11000000
PIE1= %00100000
resume
enable
end
delay:
for i=1 to 400
pause 1
next i
return
I want to read keyboard and show the numbers on lcd by pushing any number and also i want to recieve
serial data from an RF module so i have to enable interrupt.
How can i do it?
i use a PIC16F873A.
i have written a program that you can see here .i think i have problem with my program.
could youb help me with this?
i use micro code studio picbasic pro2.41
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
start:
on interrupt goto int
INTCON = %11000000
PIE1= %00100000
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.0,N1200,["A"],y1
serin PORTA.0,N1200,["A"],y2
serin PORTA.0,N1200,["A"],y3
'
if (y2=y3) then
lcdout $fe,1,#y2
pause 4000
lcdout $fe,1
pause 4000
endif
INTCON = %11000000
PIE1= %00100000
resume
enable
end
delay:
for i=1 to 400
pause 1
next i
return