|
|
View previous topic :: View next topic |
Author |
Message |
hlukeh
Joined: 10 Aug 2004 Posts: 6
|
Know why INT_RB interrupt in devices.h files changed? |
Posted: Fri Mar 02, 2007 12:13 pm |
|
|
Hello,
I am looking at migrating from PCW 3.184 to 4.025 and I am looking for potential problems. I have noticed one difference which I can't figure out the reason for, and that's the change in interrupt location for:
#define INT_RB 0xF208
to
#define INT_RB 0xFFF208
at the very bottom of the 18F6680.h file. I have noticed that almost all of the devices.h files in PCW 4.025 have 0xFFF208 but in PCW 3.184 they have 0xF208. Does anyone happen to know the reason for this change? All the other interrupt locations have stayed the same.
The devices.h files I am referring to are in:
C:\Program Files\PICC\Devices
Thanks,
Luke |
|
|
Ttelmah Guest
|
|
Posted: Fri Mar 02, 2007 3:35 pm |
|
|
This is not an interrupt 'location'. The definitions here, are bit masks, used to identify the correct bit in a number of internal registers. The extra byte is used by the internal code, to handle chips that allow individual bits of the port to be masked on/off.
Why on earth does it matter?. The whole 'point' of defines like this, is that you should only use the keywords, and not worry about what happens behind the scenes.
Best Wishes |
|
|
hlukeh
Joined: 10 Aug 2004 Posts: 6
|
|
Posted: Mon Mar 05, 2007 4:34 pm |
|
|
Well if that's the case thanks for the reply. It still doesn't really make sense that it would change, but I guess I won't worry about it. |
|
|
barryg
Joined: 04 Dec 2006 Posts: 41
|
|
Posted: Mon Mar 05, 2007 5:48 pm |
|
|
Pay no attention to that man behind the curtain
F208 is, in effect, the number -3576. Represented in 16 bits. The newer compilers handle bigger and fancier chips, so they've decided to use bigger numbers. FF208, as a 24 bit number is, in effect, the number -3576 If this doesn't make sense, get on the Web and read about "2's complement numbers". You said you wanted to know
And, the answer to your real question is, you don't have to worry about this breaking your code. The new compiler knows what to do with the "new" numbers. Just be sure to use the new .h files when you switch.
Barry |
|
|
Ttelmah Guest
|
|
Posted: Tue Mar 06, 2007 3:25 am |
|
|
Sorry Barry, but you are wrong.
They don't use the value as a number at all. They use it as three separate bytes. If you look at the numbers, they are the bit values to feed to the configuration registers for the required selection. Note that the values used for interrupts other than 'RB' remain the same. The point about RB, is that on a number of newer chips, this is now maskable to have individual bits enabled, so an extra byte is needed to set this up. The new compiler does not support 24bit numbers (still only 16, and 32 natively). The reason the values come the same, in 24bit notation, is that the default is to enable all the bits in this extra register, which requires all 1's, and it just happens that when treating a value as a -ve number, a top byte of all 1's, is the required value to extend a value to a larger size.
Best Wishes |
|
|
hlukeh
Joined: 10 Aug 2004 Posts: 6
|
|
Posted: Thu Mar 08, 2007 4:43 pm |
|
|
Thanks for the replies. I see what you're saying Ttelmah and it makes sense. I'm glad you also posted a comment Barry because it helped to really clear this up! |
|
|
|
|
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
|
Powered by phpBB © 2001, 2005 phpBB Group
|