need SERIAL COMM prop to prop finished code
stargazer2050
Posts: 89
Quickstart boards X2
Would like to hook them together serially with wire
Have been using 3 i/o parallel for a year bec. cant understand first thing about serial.
Tried simple serial, fullduplecserial, etc. makes no sense.
Bought xbees, got them today and they work already (need to get three digits or just two digits to transfer.)
Requesting clockloop to post his solution now please!
Would like to hook them together serially with wire
Have been using 3 i/o parallel for a year bec. cant understand first thing about serial.
Tried simple serial, fullduplecserial, etc. makes no sense.
Bought xbees, got them today and they work already (need to get three digits or just two digits to transfer.)
Requesting clockloop to post his solution now please!
Comments
This uses "open true" mode so you need to add a pull-up (3.3K suggested) between 3.3v and the serial IO line (one side will do). It's best to let one side control the conversation, but using open mode will prevent an electrical issue if both sides try to "talk" at the same time.
If you've got a BASIC Stamp manual nearby have a look at the SERIN and SEROUT commands; there's a great explanation of the use of open baud modes.
Got the stamp manual, dont know that i can get anywhere with it though.
Am using xb.rxtime(250) on xbee, switch it to serial.rxtime() ?
Turns out xbees are way slower than my 3 io asynchronous parallel because of bootup time.
Im using pulsing on each pin and just counting them with a debouncer. Might try your freq_counter.spin to speed that up.
Note that if you use .rxtime() with a parameter of 250, you system could wait up to 250 milliseconds for a response. That seems like a lot of time.
Comm is one way so far
Ill lower the 250, see what happens.
In the message, I specifically stated that you need to:
Include the FULL code you need help with.
Johnny mac is right, you shouldn't use xb.rxtime(250)
Change it to And have your program repeat attempts at getting data.
Or make it wait forever.
Also, how are you getting the data?
you don't show that you are putting the data anywhere, you are just doing this--> xb.rxtime(250)
This is the correct way to get data from the serial object and place it into a variable, and also i put in a REPEAT, to make repeated attempts at getting the data in case the first one didn't work.
With out you posting your full code, you will NOT get the kind of help you are requesting.
im getting a number on the screen of 65525 or FF or 11
still unclear how to visualize learning this.
Q1 is it safe to turn on the Monitor and USB and be on pins 30 and 31?
or does this happen on 20 and 21?
What are you trying to accomplish? Blindly throwing serial data around is not helpful. You should establish a protocol (even a very simple one) so that you have a set of rules for both sides. Not knowing what you want to accomplish, I can't suggest anything further.
So you cant just connect two computers an read rx tx back and fo rth.
Ill stick with my simple thing.
Tnx again
am receiving a '96' with the monitor turned on with 30 and 31 on that cognew AND
theres a '3' hidden behind it but can't figure where its coming from or what a '96' is
-- start the object
-- wait a few ms to let everything get going
-- flush the receive buffer
It's possible that the extra value you're seeing is trash in the buffer from start-up.
Have a look at this:
If you think about what's happening, you're filling the transmit buffer with 3 and never letting up. If you want two devices to be able to talk back and forth, you need to give each side some breathing room. In the MODBUS RTU protocol, for example, they use 3.5 byte periods of no traffic to define the space between messages. When the receiver sees this idle period it nows that the next byte in is the start of a message.
... just to start to get the hang of communicating between two Propellers. Once you get this, then you can put together a command/response packet.
Q1: how do I assemble them into a "dec" on the other side? multi digits
I'm repeating here, but once you create a protocol (i.e., define what you want to send back and forth), it will be easier to show you some code. I tend to stick with long values, but you don't have to -- but your receiver needs to know what to expect. For example, sometimes I do this:
This lets you send numbers (binary form) in Little Endian format. Again, the receiver side needs to know what's coming.
But i notice i can receive ascii hex 2 digits and use that would give me plenty.
So thankyou so very very for getting my serial knowledge up 'n running!!!