Page 1 of 1

Confusion about offset between register addresses

PostPosted: Sat Jun 02, 2018 12:36 am
by zpratt
I was looking at the addresses of individual registers in the PIC32MX250F128B. For instance in the data sheet and the header file for my chip the adresses of TRISA and TRISB are 0xBF886010 and 0xBF886110. However when I ask the chip to calculate the offset between these two addresses it returns 0x40 when I would think it would be 0x100. The chip even prints the addresses from the data sheet as the addresses of the registers. 0x40 seems to be correct or a least to the chip because it works in code.

If someone could help me understand this, it would be much appreciated. Thanks.

Re: Confusion about offset between register addresses

PostPosted: Sat Jun 02, 2018 1:27 am
by ric
I would guess it is treating the addresses as pointers to 32 bit registers, so calculating how many 32 bit words from one address to the other like a 32 bit array.