Hi E,hi C.
Try these two Basic programs [ currently set for SIM ], they work OK in Sim.
Make sure both TX and RX programs are either set for Sim or PIC.
The advantage of this method is that the number of Commands can be easily increased.
E
EDIT:
To Send to RXR
In Simulation the ? is seen as a LF
$0? or
$1?
The PIC RXR code will detect either the ? or LF as a end of msg terminator.
[No need to edit the code]
Hi E,hi C,
Unless I am losing it,
The two clips you posted are the same.??
Where is the RXR clip.?
E
main:
get_led:
rxi = 0
If RCSTA.OERR = 1 Then 'RCSTA BIT1-if over run error then flush RXD buffer
RCSTA.CREN = 0
RCSTA.CREN = 1
char = RCREG
PIR1.RCIF = 0
Endif
sync1: 'wait for a '$' start of string
If PIR1.RCIF = 0 Then Goto sync1
char = RCREG
If char <> 0x24 Then Goto sync1 '$'
str1(1) = char 'STR1 ARRAY
rxi = 2
get_msg: 'read and save
If PIR1.RCIF = 0 Then Goto get_msg
char = RCREG
str1(rxi) = char 'STR1 ARRAY
rxi = rxi + 1
If char = 0x0a Or char = 0x3f Then Goto decode 'tests for either LF or ?
Goto get_msg
decode:
If str1(2) = "0" Then
Hserout "Red Off,,,Yw On: ", CrLf
rled = 0
yled = 1
Endif
If str1(2) = "1" Then
Hserout "Red On,,,Yw Off: ", CrLf
rled = 1
yled = 0
Endif
Goto main
End
Hi E,hi C,
I don't understand what you are describing.??
Sending "1" without the '$' prefix is a waste of time.
E
Hi E,hi C,
I assume the TX and RX are on the same channel.? and that channel is not being used by some other local persons TX/RX.?
Also the Baud rates are the same, I use 9600.?
I have my Power at P8, which is the highest specified power.
How far apart are the TX and RX modules.??
E
Hi E,hi C.
Pleased to hear it works OK.
If required you can now add more commands to the TX msg and decode them in the RX.
eg:
TX = $01<crlf> ' the state of two different p/b's
RX, check the str1(2) and str1(3) array locations and set LEDs' On Off, etc...
OK.?
E
If str1(2) = "0" Then
Hserout "Red Off,,,Yw On: ", CrLf
rled = 0
yled = 1
Endif
If str1(2) = "1" Then
Hserout "Red On,,,Yw Off: ", CrLf
rled = 1
yled = 0
Endif
If str1(3) = "0" Then
Hserout "Green Off,,,Blue On: ", CrLf
rled = 0
yled = 1
Endif
If str1(3) = "1" Then
Hserout "Green On,,,Blue Off: ", CrLf
rled = 1
yled = 0
Endif
E
Hi E,hi C,
You cannot connect two TXD driver outputs together.
Connecting two RXD's reading inputs is OK, I often do that for monitoring.
Post a short Oshonsoft Basic program, say driving just two LED' s Red, Yellow I can check it for you.
E
Hi E,hi C,
Do you mean like this image.?
If Yes, it is OK.
I assume we are talking all at TTL Serial levels.?
E
View attachment 151219
Hi E,hi C,
Repeating my earlier note:
You cannot connect two TXD driver outputs together.
E