3 way communication - Plz help!!!!!!!!
computer guy
Posts: 1,113
I am trying to get my propeller to talk to my BS2 and my BS2 to talk to my computer (VB2005) Program.
However I am having difficulty synchronizing the devices.
How would I get them to talk and listen at the right times.
Thank you
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller robot.tmcp.com.au
If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
anthonybmyatt@yahoo.com.au
Post Edited (computer guy) : 10/10/2007 1:24:41 AM GMT
However I am having difficulty synchronizing the devices.
How would I get them to talk and listen at the right times.
Thank you
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller robot.tmcp.com.au
If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
anthonybmyatt@yahoo.com.au
Post Edited (computer guy) : 10/10/2007 1:24:41 AM GMT
Comments
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
2) Usually this kind of thing gets easier when one device serves as a master and the others are slaves. The master provides the control to keep things in sync.
3) If you don't want to use a master / slave(s) setup, you can use a multidrop network setup where all of the transmit lines use an open collector/drain type of connection and the receive lines and transmit lines are connected together ... a party line. Any party can transmit at the same time ... there has to be error control and some rules about when to try again if your transmission fails because someone else transmitted at the same time. The Ethernet uses this type of protocol. A lot of the algorithms were developed as part of the Aloha-net project which was one of the first wireless network implementations.
I am using the USB port on the BS2 (serial) and am planning on using serial between the BS2 and Prop.
I don't know anything about serial communication, so an example with code snippets would probably help.
Thank you
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller robot.tmcp.com.au
If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
anthonybmyatt@yahoo.com.au
What I want to do is the computer says hello to the BS2.
The BS2 says hello to the prop.
The prop tells the BS2 lots of info.
The BS2 relays this to the computer with some of its own info.
The BS2 then every 2 seconds sends info to the Computer with any info it may have gotten from the Prop during that 2 second gap.
They are wired up like so:
Thank you
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller robot.tmcp.com.au
If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
anthonybmyatt@yahoo.com.au
Post Edited (computer guy) : 10/10/2007 1:08:04 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller RECONAUTOR
How many COGs do you expect to use? Why?
You have to allocate time slots for the communications... Di they overlap? Do they have to?
A slave is a listener! Carefully design, who the listeners are...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?
I have read that article, it was the first article I read after not getting any responses to this forum thread.
So I basically just have to do a trial and error process.
At the moment I can get the BS2 to send Info to the PC and get the PC to display 50% of this.
The buffer in FullDuplexSerial would be nice, however that probably won't ever be used as the Prop very rarely recieves.
The reason I have a BS2 in the middle is because I am using the BS2 to monitor battery levels, as I have only 2 pins left on the propeller.
So I have the propeller sending debug information to the BS2, the bs2 than gets this and send it with the battery levels from it to the PC.
Thank you
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller RECONAUTOR
I guess with the type of data you're sending, maybe 100 byte messages are too long. Pick any length that meets your needs.
When your BS2 gets a message from the PC that means "send data" it would forward the same packet to the propeller. Whatever the propeller sends to the BS2 would just get forwarded to the PC (after it's received in it's entirety and checked for validity). You would need to set up transmit and receive buffers for holding your packets while you evaluate the ones you receive or compile the ones you will send.
Is any of this helpful?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?
However I have no idea how to implement it.
The data I am sending is:
Name: 10 char
Ver: 3 char
Date: 8 char
Description: 100 to 500 char
bat1 level: 2 char
bat2 level: 2 char
general debug: 4 to 20 char
Thank you
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller RECONAUTOR
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?
The FIRST thing you need to consider is packet length...
I assume you're using 9600bps?
If so, that would IDEALLY take half a second, or so.
In that time the BS2 can't do anything else as it doesn't have a RX or TX buffer.
Older transfer protocols often used 128Byte packets because of problems with line noise and speed.
It may be a good idea to define several 'query codes':
PC sends $FF:
BS2 sends a general 'status package' with $FF Version, date, battery levels, $CRC
PC sends $EE$00
BS2 sends $EE$00 and first 32Bytes of description. + $CRC
PC sends $EE$01 to get next 32Bytes and BS2 responds with $EE$01 and 32Bytes... and so on...
When the remaining description is shorter than 32Bytes, it responds with $EE$FF and sends the block, padded with spaces at the end.
If you also use Hardware handshaking, you should be able to avoid the BS2 losing any comms from the PC.
Of course, if you used another Propeller you won't have to fight with the BS2's singletasking/no buffer problem....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't visit my new website...
Stamp --> Propeller
Propeller--> PC
Maybe borrow/emulate the appmod protocol?· The stamp waits to see·a "!BAT"· command before sending it's data.· The Propeller or PC sends "!BAT", then the Stamp sends the data.· If you wanted to talk to the Propellor, the Stamp will ignore anything that dosen't start with "!BAT".· In the protocol, the "!" is not really a critical·bit, it's designed more to sychronize the transmitter/reciever.·
Also,·you could do something similiar for the Propeller, like "!RBT"· for robot, then the Propeller sends it's data to the PC.
The Propeller can have a buffer and with a dedicated (or semi-dedicated) cog, won't miss much data.· Also, you may be able to increase your send/recive speeds to/from the PC.· If the Stamp misses the query, you can wait for a little bit and try again, while·the Propeller could send the last good data it has to the PC, thus not holding up your application.
I hope this helped!
So rather than just sending and receiving I should tell the sender that I am ready to receive first.
Thank you
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller RECONAUTOR
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?
Thank you
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller RECONAUTOR