Need help with Method coding, see attached "Spin" file.
Hello,
Please see attached files.
The attached files·are running in my "Transmitter" and·"Reciever" Prop's. I am transmitting (9) bytes that are being saved into an array to the reciever. I can monitor the data as it is being recieved via a LCD and via the transmit & recieve lights on my trancievers.
My problem is this:
1) I am entering (3) sets of 3 digit numbers on the "Transmitting end", into a (9) byte array. As the last digit is entered it transmits the bytes to the reciever.
2) On the recieving end I can see via my tranciever that it has recieved the data but it is not being sent to the LCD until I send a "second set of 3 digit numbers". I am assuming that I·have coding errors in my "Recieve method" since it is taking exactly Twice the number of bytes recieved before the data is sent to the LCD, Probally te reason for the data confusion showing up on my LCD also. Please let me know if you see something wrong.
3) I am getting the numbers on my LCD on the recieving end after the second set of "3" digit numbers are sent. But sometimes they are in the correct order and sometimes they are not.
4) For example: When I enter 214, 213, & 215 on the keypad on my transmitting end I get the correct numbers in the correct order on my reciever. By this I mean that I get 123, 124 & 125. For some reason the 1 and
the 2 are swaped when it is sent to the LCD.
5) If I send all 1's for the first set of (3) digit numbers, I see them transmitted to the reciever. When I send the second set of (3) digit numbers all (2's) I get
1's and 2's when the data shows on the LCD, recieving end.
Note: The data is suppose to be sent to the LCD on the recieving end after
the first set of 3 digit numbers are recieved or the first "9" bytes. Therefore I believe that my problem is most likely in my "Recieve" code.
Thanks for any help that you can give,
JMLStamp2p
Please see attached files.
The attached files·are running in my "Transmitter" and·"Reciever" Prop's. I am transmitting (9) bytes that are being saved into an array to the reciever. I can monitor the data as it is being recieved via a LCD and via the transmit & recieve lights on my trancievers.
My problem is this:
1) I am entering (3) sets of 3 digit numbers on the "Transmitting end", into a (9) byte array. As the last digit is entered it transmits the bytes to the reciever.
2) On the recieving end I can see via my tranciever that it has recieved the data but it is not being sent to the LCD until I send a "second set of 3 digit numbers". I am assuming that I·have coding errors in my "Recieve method" since it is taking exactly Twice the number of bytes recieved before the data is sent to the LCD, Probally te reason for the data confusion showing up on my LCD also. Please let me know if you see something wrong.
3) I am getting the numbers on my LCD on the recieving end after the second set of "3" digit numbers are sent. But sometimes they are in the correct order and sometimes they are not.
4) For example: When I enter 214, 213, & 215 on the keypad on my transmitting end I get the correct numbers in the correct order on my reciever. By this I mean that I get 123, 124 & 125. For some reason the 1 and
the 2 are swaped when it is sent to the LCD.
5) If I send all 1's for the first set of (3) digit numbers, I see them transmitted to the reciever. When I send the second set of (3) digit numbers all (2's) I get
1's and 2's when the data shows on the LCD, recieving end.
Note: The data is suppose to be sent to the LCD on the recieving end after
the first set of 3 digit numbers are recieved or the first "9" bytes. Therefore I believe that my problem is most likely in my "Recieve" code.
Thanks for any help that you can give,
JMLStamp2p
Comments
The first data.rx is simply ignoring every first byte sent and the second one only getting every second byte. Also, why are you making byte[noparse][[/noparse]datains]:=0? I can't see that the zero at the end is used anywhere. Hope this helps.
I must be misundestanding this code completely. I thought that " byte[noparse][[/noparse]datains] := 0 "
was reseting the array pointer to location [noparse][[/noparse]0] after " Num_of_nums-- == 0 " had become true. If Recieved_Data is called and Num_of_nums starts out at "9" which would make the the statement False
is data.rx not waiting for a byte via FullDuplexSerial and then assign that byte to " rxbyte " the return varible ? The line below this " byte[noparse][[/noparse]datains++] := rxbyte " I thought wrote the first byte coming in to location "0" in the array then incremented the array pointer and looped back for the second byte, ect. When Num_of_nums is true or equal to "9" the indented code below it would execute,
set the array pointer to "0" and return to Main.
This may be the problem, would you please give me an example of how it should be. I have been pulling my hair out trying to get this block of code correct :>)
Thanks for taking the time to look at the code and reply. It is greatly appreciated !
JMLStamp2p
You were right, I simply took out the line "data.rx" as I realized that rxbyte := data.rx
was already calling the rx method and assigning the recieved byte to rxbyte.
Everything is working correctly now, I get the bytes showing on the recieve end after 9 bytes are sent and they are in the correct order,ect.
Thank You so much for your help, I can't begin to tell you how much this simple fix does
for my program.
Sincerely,
JMLStamp2p
A simple question :>)
How do you post code as you have showing in the gray box with the Blue letters
above ?
JMLStamp2p
byte[noparse][[/noparse]datains]:=0 is writing 0 to the byte at the address that is in datains. This only gets run when you are exiting your routine and will be the 10th byte in your array which is fortunately not used. I think what you are trying to do is set the location back to the start of the array but this is done every time you call the method because it is passed in in the parameter list.
Edit: you should now be able to see the [noparse][[/noparse] i], it got me again
Post Edited (stevenmess2004) : 3/7/2008 11:07:45 PM GMT
Also BTW: Wouldn't it now be time to get rid of this eye hurting if cascade?
Get out your Manual and read what it has to say about LOOKDOWNZ !
This was formatted using this www.phipi.com/format/ page which looks after everything. Just past your code, press format and copy into your post.
Got it fixed thanks to your post.
Very much appreciated !
JMLStamp2p