The best way of sending Serial Data?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

The best way of sending Serial Data?

Post by Jordy101091 »

Hi all,

I'm finally graduated from school 8), and back from vacation :? .
So I have plenty of time to work on all kinds of electronic projects :wink:.

I want to know how you guys are transmitting you data over a serial bus like RS232 / RS485.
What I'm planning to do is build a system where you would have a base unit and from there on you can hook up all kinds of accessories.
I want to make this plug - and - play where the base unit (master) will automatically detect the new connect device.

for instance:

You have the base unit (Master) and there are 2 (or more) slaves connected

Slave one.= Temperature sensor
Slave two.= Hydro Sensor

What is the best and most robust way of sending and retrieving data from these slaves.
I want to hear what you think of this and how would solve this.

Regards Jordy
the will to learn, should not be stopped by any price

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times

Re: The best way of sending Serial Data?

Post by JohnCrow »

Hi Jordy

Congratulaions on passing the exams.
1 in 10 people understand binary, the other one doesn't !

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: The best way of sending Serial Data?

Post by Jordy101091 »

JohnCrow wrote:Hi Jordy

Congratulaions on passing the exams.
Thanks,

I can call myself now a electrical engineer :wink:

Regards jordy
the will to learn, should not be stopped by any price

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times

Re: The best way of sending Serial Data?

Post by brandonb »

i didn't have anything on computer so i wrote this up for you as an example :wink:
when using rs232 uart the slave tx lines will short is more than one is hooked to same chip pin, what i do is use a multiplexer chip, like this, it takes two uart tx lines and outputs one signal
pro_dash_mux.fcf
(12.7 KiB) Downloaded 316 times
, if you rig this up to a 16f1829 you have 10 port interrupts so can mux 10 tx lines into one, the timing from the master to get the signals is critical to keep everything in synch
here is the one's i drew up this morning, this is the master
mini28 uart pwm send.fcf
(19.89 KiB) Downloaded 345 times
this is the slave
mini44 uart pwm receive.fcf
(25.73 KiB) Downloaded 327 times
the way this works is, its a simple draw up, the master chip is just a rc5 remote control acting like a keypad, when i input a number i can press a button to send it, when i do send it the keypad number returns back to zero, there is another key that also returns the value to zero incase when inputting data a digit gets missed, when you select to send the data thats on the screen it sends the number 0-511 out on the 9 bit uart tx
the slave chip is programmed only to respond to the address of 501!!!
what this does is it controls 5 pwms on the slave chip
the addresses are 501 to 511 so can have 10 chips on uart line,
its programmed to where it wont do anything unless a number 501-511 is received
when it is received it is locked on that slave chip and you won't have to enter the address again unless you want to talk to another slave, you can send a pwm address 300-304 which controls pwm#s 0-4
after that is sent you just send number 0-100 to control the dutycyle on the selected pwm module
you can also get the value from any of the pwms 0-4 by sending 400-404, it will return the dutycyle for that pwm on the screen
notice when in the pwm mode you don't have to keep sending the command for that pwm or for the chip address because its designed to be locked in until you changed it
you can see that its really easy to create a touch screen program that can control many chips with all kinds of functionallity with this approch
can make it when you ask for a certain pwm% you can increment it from there but i didn't put that functionallity into it yet on this one
did this help you out?

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times

Re: The best way of sending Serial Data?

Post by kersing »

Basically RS232 is for communication between two devices. There are work-arounds with multiplexers etc. RS485 is a multi device bus, so probably the better option.

When attaching new devices to the bus they must somehow signal the master there is a new device, so you will need to design a protocol to handle that. Also RS485 is a half duplex bus allowing multiple masters but without collision detection, so you'll need to keep that in mind while designing the protocol as well :-)

You might want to take a look the elektor bus.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times

Re: The best way of sending Serial Data?

Post by brandonb »

kersing, can you explain how to convert to rs485 without buying boards?

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times

Re: The best way of sending Serial Data?

Post by kersing »

brandonb wrote:kersing, can you explain how to convert to rs485 without buying boards?
Have you checked the elektor site? The item numbered 6 has a freely down-loadable diagram (registration required) using the LT1785. The data sheet for it has some typical application examples as well.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times

Re: The best way of sending Serial Data?

Post by kersing »

Also you could take a look at the data sheet for EB062 and build the circuit yourself...
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: The best way of sending Serial Data?

Post by Jordy101091 »

Oke I have search the internet for a possible solution, and I think I found it,so I thought.
I came across the following bus CAN.

Everywhere I look on the internet people are saying that CAN bus is the most easiest bus of all to work with.
When I investigate the macros provided with Flowcode a little more it doesn't seem so easy anymore.

I hope somebody can explain how it works because I do not understand what all the buffers, IDs ect mean.

Regards Jordy
the will to learn, should not be stopped by any price

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times

Re: The best way of sending Serial Data?

Post by dazz »

Hi Jordy
have a look at the attached doc, it should help

Regards
Dazz
Attachments
can20.pdf
(187.97 KiB) Downloaded 352 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Post Reply