I will do that thanks a lot.
Yesterday i tried till late at night to set a code for the TX and RX, a very simple one but didnt work.
tx:
Code:
'*-----------------------------------------------------------------------------|
'* | --------------------- | |
'*----------------------- | EUART 1 Configuration | --------------------------|
'* | --------------------- | |
'*-----------------------------------------------------------------------------| |
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
DEFINE HSER_SPBRG 130 ' 9600 Baud @ 64MHz, -0.02%
SPBRGH = 6
BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
'------------------------------------------------------------------------------|
ID VAR BYTE
button1 var porta.0 ' we configure this button 1 at porta.0
button2 var porta.1 ' we configure this button 2 at porta.1
RED var latc.3 ' a RED LED indicates the PIC working condition
Blue var lata.2 ' a Blue LED indicates the push button everytime
high red
pause 100
low red
pause 50
high red
'------------------------------------------------------------------------------|
BEGIN:
ID = 10
if button1 = 0 then
gosub button1_pressed
endif
low blue
GOTO BEGIN
'------------------------------------------------------------------------------|
button1_pressed:
high blue
hSEROUT [ID] ' we send at portc.6 which is connected the IR module at the 74LS00 in pin No2
PAUSE 100
return
button2_pressed:
high blue
hSEROUT [ID] ' we send at portc.6 which is connected the IR module at the 74LS00 in pin No3
PAUSE 100
return
end
RX:
Code:
'*-----------------------------------------------------------------------------|
'* | --------------------- | |
'*----------------------- | EUART 2 Configuration | --------------------------|
'* | --------------------- | |
'*-----------------------------------------------------------------------------| |
DEFINE HSER2_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER2_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER2_CLROERR 1 ' Clear overflow automatically
DEFINE HSER2_SPBRG 130 ' 9600 Baud @ 64MHz, -0.02%
SPBRGH2 = 6
BAUDCON2.3 = 1 ' Enable 16 bit baudrate generator
'-------------------------------------------------------------------------------|
ID con 10
Green var lata.1 ' a Green LED which indicates the 1st output of the IR input code
Blue var lata.0 ' a Blue LED indicates the 2nd output of the IR input code
Red var lata.2 ' a Red LED indicates the PIC working condition
'------------------------------------------------------------------------------|
' RED LED indicates that PIC is up and running |
'------------------------------------------------------------------------------|
high red
pause 100
low red
'------------------------------------------------------------------------------|
Begin:
hSERin2 [wait(ID)]
high red
'pause 100
gosub FIRST_SIGNAL
' endif
'------------------------------------------------------------------------------|
FIRST_SIGNAL:
high green
pause 500
low green
return
end
Bookmarks