Its me again .
I`m trying send data from pic to pic via usart.bas.
I`m having the following problem:
When i hard wire the 2 pic`s, TX and RX all goes well!
But when i plug the 433mhz thingies it works not nearly as well..
The 433mhz thingies
Here`s my code for both RX an TX.
The TX code:
Code: Select all
Device = 18F452
Clock = 20
Include "usart.bas"
// opties voor usart.bas module
#option USART_BRGH = false
//Dim result As Boolean
Dim led1 As Byte
Dim led2 As Byte
Dim syn As Byte
//dim syn2 as byte
syn = $AA
led1 = $3e
led2 = $89
SetBaudrate(br19200)
While true
//WriteByte(syn) //sync 433mhz
If PORTC.3 = 1
Then
WriteByte(led1) // send the command
DelayMS(100)
Else
WriteByte(syn) //sync 433mhz
EndIf
If PORTC.2 = 1
Then
WriteByte(led2) // send the command
DelayMS(100)
Else
WriteByte(syn) //sync 433mhz
EndIf
Wend
Code: Select all
Device = 18F452
Clock = 20
Include "usart.bas"
// opties voor usart.bas module
#option USART_BRGH = false
Dim result As Boolean
Dim ontvang2 As Byte
Dim led As PORTD.0
Dim led2 As PORTD.1
Dim ontvang1 As Byte
SetBaudrate(br19200)
ontvang1 = $3E
ontvang2 = $89
While true
result=USART.WaitForTimeout(ontvang1,20) 'look for return byte value and timeout(1000ms) if failed, result is true if value matches
If result = true
Then
High(led)
Low(led2)
Else
//low(led2)
EndIf
result=USART.WaitForTimeout(ontvang2,20) 'look for return byte value and timeout(1000ms) if failed, result is true if value matches
If result = true
Then
Low(led)
High(led2)
Else
//High(led2)
EndIf
Wend
But most of the time i need to push the switch 3 or more time`s.
And when i disconnect power of the TX the RX switches constantly .
What can this be?
Greets.
Gert