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
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
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
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
Last edited by Ioannis; - 16th June 2010 at 19:54.
You might want to verify your send/receive data rates as well.
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
No, you receive loop is wrong in the logic.
Try this for the receive part:
Code: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
Bookmarks