Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Accessing Pic SFRs as an array.

Status
Not open for further replies.

Pommie

Well-Known Member
Most Helpful Member
I've been playing around with a pic again and needed to access the PPS SFRs located sequentially in memory at 0xF18. The first one is RB0PPS and to access them as an array you can do,
((unsigned char *)&RB0PPS)[7]=0x01;
This would write 1 to RB7PPS. This would enable the CLC1 output on RB7.

Well, I found it useful.

Mike.
 
PPS is indeed a minefield. I tend to move just the bit I need (input or output) and the above was to move CCP1's output to RB0 through RB7.

Mike.
 
Yet another reason I like the CCS compiler - just tell it what peripheral pin allocations you want & it sets the appropriate registers:
C:
#PIN_SELECT U1TX = PIN_B4
#PIN_SELECT U1RX = PIN_B15
 
Yet another reason I like the CCS compiler - just tell it what peripheral pin allocations you want & it sets the appropriate registers:
C:
#PIN_SELECT U1TX = PIN_B4
#PIN_SELECT U1RX = PIN_B15
Yes, the code configurator will do that but accessing them as an array is much more flexible.

Mike.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top