Importing pin constants?
bte2
Posts: 154
Hi, this might be completely obvious, but I was wondering if there was a way, using Propeller Tool, to maintain a separate file of pin constants from my main object file.
Right now I have a complete program that I would like to use with different pin assignments depending on which board I load it into, without maintaining different versions of the master program or copying and pasting the pin constants or editing the master in any way (if possible)
For example, I might have 3 different boards that I want to do the same thing, just with different pins.
I would LIKE to have a file structure like:
board1pinouts.spin
|___masterprogram.spin
board2pinouts.spin
|___masterprogram.spin
board3pinouts.spin
|___masterprogram.spin
, where I open the file with the board-specific constants, and this file would then "include" my master.
Can I do it this way somehow, or am I just missing it?
Thanks in advance! -bryan
P.S. I did read the manual, and I did try to search the forum before I asked.
ETA- I am aware of the concept of objects, what I am trying to avoid is manipulating the master in any way. Right now, I have a separate commented line for selecting different versions of the same object that I remove the tick to employ that particular board. I would rather use the pinouts file as the top object and have the compiler insert the master program inline. This way, each of my Propeller boards can have it's own unique pinout file that I can use for any program.
Right now I have a complete program that I would like to use with different pin assignments depending on which board I load it into, without maintaining different versions of the master program or copying and pasting the pin constants or editing the master in any way (if possible)
For example, I might have 3 different boards that I want to do the same thing, just with different pins.
I would LIKE to have a file structure like:
board1pinouts.spin
|___masterprogram.spin
board2pinouts.spin
|___masterprogram.spin
board3pinouts.spin
|___masterprogram.spin
, where I open the file with the board-specific constants, and this file would then "include" my master.
Can I do it this way somehow, or am I just missing it?
Thanks in advance! -bryan
P.S. I did read the manual, and I did try to search the forum before I asked.
ETA- I am aware of the concept of objects, what I am trying to avoid is manipulating the master in any way. Right now, I have a separate commented line for selecting different versions of the same object that I remove the tick to employ that particular board. I would rather use the pinouts file as the top object and have the compiler insert the master program inline. This way, each of my Propeller boards can have it's own unique pinout file that I can use for any program.
Comments
Include that file into all your other apps objects, as needed, in the normal OBJ section.
You can include that constants object in any number of other objects in a single program without any problems.
I think that does what you want.
File: C:\My Stuff\My Board1\toaster.spin
con
heater = 0 'pin0
latch = 1 'pin1
sensor = 2 'pin2
etc...
include "C\Propeller\perfecttoastercontrolthatIdontwanttomesswith.spin"
end
So inside a directory, there might be:
Board1234toaster.spin
Board1234washingmachine.spin
Board1234dishwasher.spin
Board1234trashcompacter.spin
They are all the same board, but run different programs. It would be great to merely click on the board-specific file and have it do the rest automatically. If my master needs tweaking, the changes would appear for any board file that subsequently called it.