Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
SwitchMan
PostPosted: May 27, 2012 - 09:53 PM
Newbie


Joined: Jan 10, 2012
Posts: 10


Hi, I need starting help. Is there anyone that can write me two programs one for master and one for slave with the recommended baud rate, that can show me how to push a button connected to a Atmega32, and then a led attached to an another Atmega32 will light up. The two Atmega32 are connected by using two MAX485 transreceivers IC.
The hardware should be ok.
 
 View user's profile Send private message  
Reply with quote Back to top
js
PostPosted: May 27, 2012 - 11:36 PM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20400
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

Quote:
there anyone that can write me two programs one for master and one for slave with the recommended baud rate, that can show me how to push a button connected to a Atmega32, and then a led attached to an another Atmega32 will light up.
No problems, lots of people can do it.

What is your budget cost wise and how do you intend to pay?

...OR do you mean you want to LEARN how to do it yourself? Not clear.

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
larryvc
PostPosted: May 28, 2012 - 12:08 AM
Raving lunatic


Joined: Dec 06, 2007
Posts: 2512
Location: Redmond, WA USA

I'm not even going to bid for the contract. You can have it John.

Switchman, nobody here is going to write code for you. You will have to start to write code and then come back here and ask questions when things do not work properly.

_________________
Larry

Those afraid to embrace the future will quickly fade into the past. - larryvc
 
 View user's profile Send private message  
Reply with quote Back to top
Kartman
PostPosted: May 28, 2012 - 04:00 AM
Raving lunatic


Joined: Dec 30, 2004
Posts: 8789
Location: Melbourne,Australia

This sounds like a job for Arduino. Not for mega32 though but you'll probably be able to source the mega328s fairly cheaply.
 
 View user's profile Send private message  
Reply with quote Back to top
js
PostPosted: May 28, 2012 - 04:28 AM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20400
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

Quote:
You can have it John.
SwitchMan started to swear at me with PMs with words like C++ and Programmer's Notepad. Laughing

SwitchMan (you told me your name in private so it stays that way), thanks for the PMs and the offer but I wasn't really going to make a job out of this. As you REALLY want to learn getting someone else to do the project will not help you much in learning.

We can help you out and at no cost Smile if you start with basic stuff and then move forward from there, there are lots of tutorials in the tutorial forums and lots of working finished projects in the project area.

So the idea is: You start with something like the switch and led, then move to something like the USART and maybe timers, when these things are ABSOLUTELY CLEAR in your mind you can start tackling the RS485 comms.

By the way ANY reason why you want to launch into RS485 and not simpler RS232 to start with?

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
SwitchMan
PostPosted: May 28, 2012 - 05:10 AM
Newbie


Joined: Jan 10, 2012
Posts: 10


I didnt know that words like C++ and Programmers Notepad was swear words, sorry if I said something wrong. Like you all, Im a person that knows a lot of different things, I just dont know so much about MCUs yet. I have used some hours on the internet and have programmed MCUs to control leds, blinking and running and so. I just wanted to ask if there is anyone that can take a job like this, and as i said: for me this will be as a platform I can start on and learn, play and build from. For me this would be as a guide in the right direction instead of just trials and errors. Sometimes it can be a little difficult just putting two and two together without anybody to ask.
 
 View user's profile Send private message  
Reply with quote Back to top
MBedder
PostPosted: May 28, 2012 - 05:16 AM
Raving lunatic


Joined: Nov 02, 2009
Posts: 3239
Location: Zelenograd, Russia

SwitchMan wrote:
Im a person that knows a lot of different things
Every time I hear/read such statement, I suspect the opposite. Unfortunately I wasn't wrong even a single time Laughing
 
 View user's profile Send private message  
Reply with quote Back to top
js
PostPosted: May 28, 2012 - 09:25 AM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20400
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

Quote:
I didnt know that words like C++ and Programmers Notepad was swear words
Of course you saw the smiley at the end of my sentence. Smile

Anyone that has been around here for a while knows that I have used ASM for most of my life and I can just barely scratch with C-- let alone normal C or C++. Mr. Green

No problems helping you out, how have you been programming your projects above? You mentioned Programmers Notepad so I take you are NOT using AVR Studio?

Have you had a play with the USART? There are demo projects which come with winAvr uysing the USART and other peripherals.

Also when you say "The hardware should be ok" which hardware are you using? Is there a diagram available for us to see?

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
SwitchMan
PostPosted: May 28, 2012 - 01:17 PM
Newbie


Joined: Jan 10, 2012
Posts: 10


Thank you John. The diagram I ment to use is this one from the internet, adding 120 Ohm resistors to both ends of the twisted pair.

http://uctrl.net/files/d/db/Max485_kobling.png

As far as I understand this is the way to connect the 485 IC, so I thought this should be straight forward.

I don't have big knowledge of AVR's, what I did was to follow a instruction video from internet, and then I changed the projects from there.
It was in this video they used WinAvr and Programmer's Notepad, I haven't used AVR Studio.

I will follow your your advice and play with demo projects, hopefully I will see the logic and better understand how to set it up after a while.

I use two STK16+ boards for the AVR's so I have some button's and LED's for testing.

You understand I'm new to this, but I have to start somewhere. Thank you for answering.
 
 View user's profile Send private message  
Reply with quote Back to top
Lennart
PostPosted: May 28, 2012 - 01:37 PM
Raving lunatic


Joined: Oct 29, 2006
Posts: 2758
Location: Sweden

You will also need 100nF non_polarized ceramic capacitor close to the MAX485 chip between Vcc and Gnd.
And it's quite common to add pull-up and pull-down resistors to + and - on RS485 side.
Something like 560 Ohm will work.
These resistors should only be placed in one place on the bus.
 
 View user's profile Send private message  
Reply with quote Back to top
SwitchMan
PostPosted: May 28, 2012 - 08:02 PM
Newbie


Joined: Jan 10, 2012
Posts: 10


Thanks for all the information. This help is very useful to me. If I say I understand fully where to put on the 560 Ohm resistors, Im not 100% correct, but Im sure I will get it right soon. I have read that the 485 IC is quite sensitive, so I assume thats why the capacitor is placed.

Thanks you very much.
 
 View user's profile Send private message  
Reply with quote Back to top
js
PostPosted: May 28, 2012 - 11:34 PM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20400
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

Some useful RS485 application notes:

National Semiconductor Application Note 847 FAILSAFE Biasing of Differential Buses
National Semiconductor Application Note 1057 Ten Ways to Bulletproof RS-485 Interfaces

I have a couple of (old Embarassed ) diagrams on my website for boards with RS485 like this one
http://www.members.optusnet.com.au/~amp ... 20diag.gif
http://www.members.optusnet.com.au/~amp ... 20diag.gif

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Lennart
PostPosted: May 29, 2012 - 01:33 AM
Raving lunatic


Joined: Oct 29, 2006
Posts: 2758
Location: Sweden

Quote:
If I say I understand fully where to put on the 560 Ohm resistors, Im not 100% correct, but Im sure I will get it right soon.

This is one document that might help.
You can also google for other information on those resistors.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits