Hello,
I've been playing with this project for sometime and a lot of ya'll have been a great help.
I am trying to get my transmitter side working and I would like to be able to press more than one button at a time to get multiple outputs to come on if needed. with the below example everything works fine, one button at a time and If I press the button the output stays on until I release the button but if I press more than one button everything comes on and goes off and acts crazy:
INCLUDE "MODEDEFS.BAS"
@ DEVICE PIC16F628a,XT_OSC
@ DEVICE pic16F628a, WDT_OFF
@ DEVICE pic16F628a, PWRT_ON
@ DEVICE pic16F628a, MCLR_ON
@ DEVICE pic16F628a, BOD_ON
@ DEVICE pic16F628a, LVP_OFF
@ DEVICE pic16F628a, CPD_OFF
@ DEVICE pic16F628a, PROTECT_OFF
define osc 4
CMCON=%00000111
trisb = %11111111
trisa = %00010111
chk_sum var byte
dgood var porta.2
serpin var porta.3
nokey con %11111111
synch con 254
address con %00000001
keyin var portb
keydata var byte
E VAR PORTB.0
D VAR PORTB.1
G VAR PORTB.2
A VAR PORTB.3
B VAR PORTB.4
C VAR PORTB.5
F VAR PORTB.6
na VAR PORTB.7
keydata1 var byte
PreAmble CON $A5
findkey:

if A = 0 then
keydata.1=1
keydata.2=1
keydata.4=1
keydata.6=1
endif

if B = 0 then
keydata.0=1
keydata.3=1
keydata.4=1
keydata.6=1
endif

if C = 0 then
keydata.1=1
keydata.3=1
keydata.4=1
keydata.6=1
endif

if D = 0 then
keydata.0=1
keydata.2=1
keydata.5=1
keydata.6=1
endif

if E = 0 then
keydata.1=1
keydata.2=1
keydata.5=1
keydata.6=1
endif


if F = 0 then
keydata.0=1
keydata.3=1
keydata.5=1
keydata.6=1 s
endif

if G = 0 then
keydata.1=1
keydata.3=1
keydata.5=1
keydata.7=1 s
endif
keydata1=keydata
low dgood
pause 100
chk_sum = (address + address)
chk_sum = chk_sum + (keydata + keydata)

serout serpin,N2400,[$55,$55,$55,$55,$55,$AA,$AA,$AA,$AA,$AA,synch,addr ess,address,keydata1,keydata1,chk_sum]
if keyin = nokey then x2
goto findkey

x2:
high dgood
keydata1 = %00000000
keydata = %00000000
serout serpin,N2400,[$55,$55,$55,$55,$55,$AA,$AA,$AA,$AA,$AA,synch,addr ess,address,keydata1,keydata1,chk_sum]
goto findkey

end

If I do it like this:

INCLUDE "MODEDEFS.BAS"
@ DEVICE PIC16F628a,XT_OSC
@ DEVICE pic16F628a, WDT_OFF
@ DEVICE pic16F628a, PWRT_ON
@ DEVICE pic16F628a, MCLR_ON
@ DEVICE pic16F628a, BOD_ON
@ DEVICE pic16F628a, LVP_OFF
@ DEVICE pic16F628a, CPD_OFF
@ DEVICE pic16F628a, PROTECT_OFF
define osc 4
CMCON=%00000111
trisb = %11111111
trisa = %00010111
chk_sum var byte
dgood var porta.2
serpin var porta.3
nokey con %11111111
synch con 254
address con %00000001
keyin var portb
keydata var byte
E VAR PORTB.0
D VAR PORTB.1
G VAR PORTB.2
A VAR PORTB.3
B VAR PORTB.4
C VAR PORTB.5
F VAR PORTB.6
na VAR PORTB.7
PreAmble CON $A5 ' 10100101 preamble
findkey:
if A = 0 then sw0
if B = 0 then sw1
if C = 0 then sw2
if D= 0 then sw3
if E = 0 then sw4
if F = 0 then sw5
if G = 0 then sw6
goto findkey

sw0:

keydata = %01010110
goto dout

sw1:
keydata = %01011001
goto dout
sw2:

keydata = %01011010
goto dout

sw3:

keydata = %01100101
goto dout

sw4:

keydata = %01100110
goto dout

sw5:

keydata = %01101001
goto dout

sw6:

keydata = %01101010
goto dout

dout:
low dgood
pause 100
chk_sum = (address + address)
chk_sum = chk_sum + (keydata + keydata)
goto transmit

transmit:

serout serpin,N2400,[$55,$55,$55,$55,$55,$AA,$AA,$AA,$AA,$AA,synch,addr ess,address,keydata,keydata,chk_sum]
if keyin = nokey then x2
goto findkey

x2:
high dgood
keydata = %00000000
serout serpin,N2400,[$55,$55,$55,$55,$55,$AA,$AA,$AA,$AA,$AA,synch,addr ess,address,keydata,keydata,chk_sum]
goto findkey
end

Then the output selected on the receiver will come on and stay on until I press the next button in which the first output goes off and the second comes on, and so on. So what is the difference between just changing a bit in the byte and sending it serially or changing the whole byte each time? Is there a better way to detects several buttons pressed at the same time and then send the data out?

Thanks