Confusion about offset between register addresses

This forum handles questions and discussions concerning Microchip’s 32-bit compilers, assemblers, linkers and related tools for PIC32 MCUs.

Confusion about offset between register addresses

Postby zpratt » Sat Jun 02, 2018 12:36 am

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.
Posts: 1
Joined: Sat Jun 02, 2018 12:16 am
PIC experience: Experienced Hobbyist

Re: Confusion about offset between register addresses

Postby ric » Sat Jun 02, 2018 1:27 am

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.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
Verified identity
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Return to MPLAB XC32

Who is online

Users browsing this forum: No registered users and 5 guests