I have a pretty long list of chips for which I have 3 parameters to set and would like to avoid replicating n times the first example
Any idea or suggestions ?
Jacques
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OneOf works a bit differently to that. All of its parameters must be the names of constants, and if any of those constants have been defined then it will return true. One option if you had a single chip, or only a few chips, would be something like this:
If you have more chips, then maybe it is better to use the Chip_ constants that the compiler creates. It will always create a constant called Chip_ and then the name of the microcontroller used. Here, you can use OneOf. An example:
Another thing to consider - filtering by chip name may not be the easiest option. If you do this, you need to deal with things like LF chips, or chips that are almost identical (16F818/16F819, for example). Could you use something else? Maybe look for a system register, or use the ChipPins constant to get the pin count. If there is anything else in the chip data file that you'd like to access as a constant, let us know and maybe we can implement that.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Hugh for your feedback I'll try that. I am currently working on a library that could allow the use of High Extended Flash memory for those new chips that do not have EEPROM. In fact a transcription in GCBASIC of the library proposed in AN1673. This is nearly done. Unfortunately HEF memory is the poorest documented part of Microchip datasheets... and I have not found a better way to assign my const variables than checking for the chip name...
Last edit: Jacques Nilo 2015-05-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello all
I am trying to define constants according to different type of chip that are being used
the following code works ok
The following code compiles ok but does not work:
I have a pretty long list of chips for which I have 3 parameters to set and would like to avoid replicating n times the first example
Any idea or suggestions ?
Jacques
OneOf works a bit differently to that. All of its parameters must be the names of constants, and if any of those constants have been defined then it will return true. One option if you had a single chip, or only a few chips, would be something like this:
If you have more chips, then maybe it is better to use the Chip_ constants that the compiler creates. It will always create a constant called Chip_ and then the name of the microcontroller used. Here, you can use OneOf. An example:
Another thing to consider - filtering by chip name may not be the easiest option. If you do this, you need to deal with things like LF chips, or chips that are almost identical (16F818/16F819, for example). Could you use something else? Maybe look for a system register, or use the ChipPins constant to get the pin count. If there is anything else in the chip data file that you'd like to access as a constant, let us know and maybe we can implement that.
Thanks Hugh for your feedback I'll try that. I am currently working on a library that could allow the use of High Extended Flash memory for those new chips that do not have EEPROM. In fact a transcription in GCBASIC of the library proposed in AN1673. This is nearly done. Unfortunately HEF memory is the poorest documented part of Microchip datasheets... and I have not found a better way to assign my const variables than checking for the chip name...
Last edit: Jacques Nilo 2015-05-22