PDA

View Full Version : transceiver 433 MHz



jonas2
- 5th June 2010, 10:06
Hello

I want a sample program in pbp, I want to send
15 bytes by the bias of an RF module 433 MHz and receive
On another module.

thank you

mackrackit
- 5th June 2010, 11:56
Have you searched the forum for examples? There a plenty out there.
Can you send and receive the data with wires?

jonas2
- 9th June 2010, 10:15
Hello

I will test this way?

touche VAR BYTE
name0 var byte
name1 var byte
name2 var byte
name3 var byte
i var byte
ID Var Byte


envoi:
SEROUT2 PORTA.3,T9600,["SYN",ID,name0,name1,name2,name3]
GOTO debut



reception:
Serin2 PORTA.3,T9600,[wait("#SYN"),ID,name0,name1,name2,name3]
GOTO debut

Ioannis
- 10th June 2010, 08:13
Maybe without the "#" symbol on he SERIN command.

Ioannis

jonas2
- 14th June 2010, 08:52
Hello
Thank you for your help, do you have a sample program.
I want to transmit and receive 24 bytes.
thank you

Ioannis
- 14th June 2010, 10:54
If your data are always 24, then use an array, load the date at the array elements and then send the array.

I 'd use Hserout if my controller has hardware USART.

Hserout [STR array\24]

or

SerOut2 port,mode,[STR array\24]

Ioannis

jonas2
- 16th June 2010, 10:13
Hello

Thank you for your help, what do you think of this program?

Compteur Var Byte '
TX_Donnee Var Byte[24] ' Donnee emission
RC_ID Var Byte ' emission IDentificateur
RX_Donnee Var Byte[24] ' Donnee reception


Loop: ' emission

For Compteur = 0 to 23 ' donnee
TX_Donnee = Compteur ' Transfert de Compteur vers TX_Donnee
Serout2 PortA.0,B2400,["#OK",RC_ID,TX_Donnee] ' envoie l'ID suivie des donnnees

Pause 100 '
Next
Goto Loop



Loop1: ' reception


Serin2 PortA.1,B4800,[wait ("#OK"),RC_ID,RX_Donnee] ' attend reception l'ID
if ID=32 THEN




Goto Loop1 ' boucle

Ioannis
- 16th June 2010, 10:46
Sorry but no!

You lack basic knowledge of the lanquage syntax.

I am sorry to say that, but you must read the PBP manual and test the commands before doing this.

Just to help you going, arrays are accessed by their element position, e.g. TX_Donnee = Compteur is wrong and should be TX_Donnee[Compteur] = Compteur.

Ioannis

Bruce
- 16th June 2010, 15:40
You might want to verify your send/receive data rates as well.

jonas2
- 18th June 2010, 09:51
Hello

Thank you for your help, I'll try this way?


j var byte
datac Var Byte '
TX_Donnee Var Byte[24] ' Donnee emission
ID Var Byte ' emission IDentificateur
RX_Donnee Var Byte[24] ' Donnee reception



Loop: ' emission

ID=32 ' l'ID

For J = 0 to 23 '
TX_Donnee[J] = datac ' Transfert de datac vers TX_Donnee

Serout2 PortA.0,B2400,["#OK",ID,TX_Donnee] ' envoie l'ID suivie des donnees
Pause 100 '
Next J
Goto Loop



Loop1: ' reception


Serin2 PortA.1,B4800,[wait ("#OK"),ID,RX_Donnee] ' attend reception l'ID suivie des donnees

if ID=32 THEN

For j = 0 to 23 '
datac[J] = RX_Donnee ' Transfert de datac vers TX_Donnee
next j

Goto Loop1 ' boucle

Ioannis
- 18th June 2010, 10:59
No, you receive loop is wrong in the logic.

Try this for the receive part:



j=0

While j<24' reception

Serin2 PortA.1,B4800,[wait ("#OK"),ID,RX_Donnee] ' attend reception l'ID suivie des donnees

if ID=32 THEN
datac[J] = RX_Donnee ' Transfert de datac vers TX_Donnee
j=j+1
endif
Wend ' boucle

jonas2
- 19th June 2010, 10:20
hello

thank you for your help