I am using #if defined TypeA or #if defined TypeB throughout my code depending on which of two product types will be connected.
This works very well but requires setting TYPE_A or TYPB_B when compiling. I am now looking to be able to switch the type via an rs232 command and wanted to know if I can re-define the system to say type_B from within the code.
Is it possible to just run the command
Joined: 06 Sep 2003 Posts: 21602
Posted: Thu Jun 18, 2009 11:48 am
The #if statements work at compile-time.
Apparently you want something that works at run-time. One method
would be have an eeprom address set to a certain value. Then you
could read the eeprom address at start-up, and load it into a RAM
variable. Then test that RAM variable at suitable points in your program
with if() statements to control program flow.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum