i tried this program for the reciver. The led blinks, If I added the serin , led would sit on high. There is definately a problem with serin command, It does not work with lcdout or simple led blinking
'RECEIVE PIC
INCLUDE "modedefs.bas"
DEFINE OSC 20 'use external 20mhz crystal
CMCON = 7 : ANSEL = 0 : ADCON1 = 7
DEFINE LCD_DREG PORTA ' Set LCD Data port
DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 1 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 0 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2500
DEFINE LCD_DATAUS 250
'try1 = count of times waiting for data, try2 = count of bytes received
try1 var byte : try2 var byte : temp var word : tempf var word
temp1 var byte : temp2 var byte : temp3 var byte : temp4 var byte
input portb.2 : pause 2500
try1 = 0 : try2 = 0
trisb=%00000000
loop:
lcdout $fe , $c0 , "Waiting.." , DEC3 try1 , "," , DEC3 try2
try1 = try1 + 1 : temp = 0 : tempf = 0
'serin portB.2 , t2400 , [ temp1 , temp2 , temp3 , temp4 ]
Portb.4 =1 : pause 500 : portb.4=0
Portb.3 =1 : pause 500 : portb.3=0
goto loop
End
I also wanted to see if the chip was able to see the data coming in, so i tried this loop, and nothing is happening to the led:
loop:
serin portB.2 , t2400 , [ temp1 , temp2 , temp3 , temp4 ]
if temp1 > 0 then
Portb.4 =1 : pause 500 : portb.4=0
Portb.3 =1 : pause 500 : portb.3=0
endif
goto loop
End
Bookmarks