Page 1 of 1

question about bit names

Posted: Mon Jan 09, 2017 12:07 pm
by Jerry Messina
I was thinking about adding the option of having the SystemConvert utility add register bit definitions to the output files, something like

Code: Select all

// ADCON0
public const
    ADON = 0,
    GO_DONE = 1,
    CHS0 = 2,
    CHS1 = 3,
    CHS2 = 4,
    CHS3 = 5,
    CHS4 = 6
This is already being done for the asm .inc file but those bit names aren't visible to the .bas modules. 'Bit names' would be a misnomer since they're actually the bit number, but it'd give you the definitions so you could do things like 'ADCON0.bits(ADON) = 1' or ' if ADCON0.booleans(GO_DONE)', etc.

Any reason why these shouldn't be added to the existing device .bas file, or would it be better to create a new file (say "P18F26K22.bas") with the definitions? Any preferences one way or the other?

Re: question about bit names

Posted: Tue Jan 10, 2017 11:40 am
by Jerry Messina
Nevermind. I think I've convinced myself it's a bad idea to add the bitnames to the device file.

While it's convenient to get them automatically, it adds a lot of global symbols so there's a good chance I might break some existing code if I add them to the device file.

I'll just add them to a separate file. That's how I do things now so it's better for me anyway. This also has the advantage that you could generate the file once, edit it to your liking and not have to worry about it changing again unless you want to regenerate it. Some of the bit names in the microchip asm file don't match the datasheet names very well.

I'll post the new systemconvert generator shortly.