More devices in one project

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

for my project I have two ATMegas communicating wirelessly. So far I have one project for TX side and one project for RX side. When I want to change some definitions for the protocol used (i.e. some timing constants) I need to update it in both files manually. What it the best way to have a common file with defines shared by two "mains"? Should I make some library included in both project or is it possible to have two different programs for two devices in one project? I am using AS7

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

2 simple ways:

 

  1. Just have a common header file shared by both projects - that will work for any IDE, or none.
     
  2. Atmel Studio allows multiple Projects within a single Solution 

 

I'd probably for (1).

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Surely you make one solution with both projects. You have them share a .h file with the common settings then you simply "build solution" (which will build both projects) after editing the header.

 

EDIT: too late, so I'm voting for Andy's option 2.

Last Edited: Wed. Jan 3, 2018 - 10:53 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for help, since I have little programming education I struggle with complicated IDEs - learning ASM is easy but learning how to use AS (or any other IDE) properly to force it to do what I want seems impossible. (2) I will do simply by File -> New -> Project and choose "Add to solution" and then I will hopefully see what needs to be done? How can I do (1)? When I was including something before I copied it into the project's directory which would not work to share one file between two projects.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Smajdalf wrote:
How can I do (1)?

Are you asking in general, or specifically for AS?

 

1. Specifically for Atmel Studio

 

You have the option to 'Add As Link'

 

Because Atmel Studio is built on Visual Studio, it is the same:

https://docs.microsoft.com/en-us/previous-versions/windows/apps/jj714082(v=vs.105)

 

 

2. In General

 

Just put your shared file(s) in some convenient folder, and have your 2 projects refer to it/them in that folder

 

eg,

 

system-root-folder --+-- tx-project-root-folder ... etc
                     |
                     +-- rx-project-root-folder ... etc
                     |
                     +-- common-folder ... etc

 

EDIT

 

MS link

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Jan 3, 2018 - 11:45 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Smajdalf wrote:
learning how to use AS (or any other IDE) properly to force it to do what I want

That's probbly the source of your problem.

 

You need to take the time to learn the way that the IDE works - trying to force it to work against that is just going to be frustrating.

 

The same applies to any tool - trying to use a screwdriver like a hammer will be frustrating!

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...