Register Field Union Defs "Backward Compatibility" why?

General discussion on mikroC PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
steve42lawson
Posts: 183
Joined: 06 Mar 2008 17:35
Location: St. George, UT
Contact:

Register Field Union Defs "Backward Compatibility" why?

#1 Post by steve42lawson » 01 Nov 2020 18:47

I don't understand why this, that I consider the better solution, is labeled "backward compatibility for...", in the "Defs" files.

Defining the register definitions as Union of Struct, with bit-mapped fields seems to me, the correct [best] way to do it. For instance, my real-life case where I want to temporarily change the Timer 1 Prescale bits. The MikroC "accepted" [apparently] way of doing it is:

Code: Select all

	TCKPS_0_bit = 1; 
	TCKPS_1_bit = 1; 
But, at least to me, a far cleaner, and more standard way of doing it is [and the way I would much rather do it]:

Code: Select all

	T1CONbits.TCKPS = 0x3;
BUT, you scare me, Mikroe, with your language!! Can I rely on this to exist in future Mikroe C compilers?! Or is this, indeed, deprecated?!?
Humility is the lack of the desire to impress, not the lack of being impressive.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Register Field Union Defs "Backward Compatibility" why?

#2 Post by filip » 05 Nov 2020 09:47

Hi,

The first notation was introduced when PRO compilers were released.
The second one is from pre-PRO compilers and was taken from the MPLAB, this is why backward compatibility is mentioned.

This is not deprecated, you can use any notation you wish.

Regards,
Filip.

steve42lawson
Posts: 183
Joined: 06 Mar 2008 17:35
Location: St. George, UT
Contact:

Re: Register Field Union Defs "Backward Compatibility" why?

#3 Post by steve42lawson » 06 Nov 2020 15:46

Cool, thank you.

May I suggest that you add that to the documentation?
Humility is the lack of the desire to impress, not the lack of being impressive.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Register Field Union Defs "Backward Compatibility" why?

#4 Post by filip » 09 Nov 2020 15:41

Hi,

Yes, I will pass this to our documentation writers.

Regards,
Filip.

Post Reply

Return to “mikroC PRO for dsPIC30/33 and PIC24 General”