PIC MX32 Port register command 'LATDINV'

W

Winston

Guest
I believe this function means 'invert the value on this PORTD pin'.

I've Googled till I need glasses but I'll be darned if I can locate the
official Microchip document that specifically states the definition of
this (and all other) port register commands.

Didn't find it in the MX32 Family Data Sheet or the assembly 'quick
reference' cards.
Didn't find it in the MIPS website.
Didn't find it in any C32 compiler reference documents.
Didn't find it at http://www.microchip.com

Found a tantalizing clue on page 20 of in Microchip's
PIC32MX USB Starter Board User’s Guide :
http://ww1.microchip.com/downloads/en/DeviceDoc/61150C.pdf

Can you please point me to the Microchip document that defines
these kinds of port control commands for the MX32 parts?

With examples? :)


Thanks and Happy Friday.

--Winston
 
In article <jqalv60mov@news1.newsguy.com>, Winston@Bigbrother.net says...
I believe this function means 'invert the value on this PORTD pin'.
It's not a function; it's the name of a register
you put a value into. If you put 0x00000001 into
LATDINV, LATD[0] gets TOGGLED(1-0, 0-1), rather
than SET or CLEARED. Same with any bit in an INV
register; the corresponding bit in the actual
register gets XOR'd with it.

I'm pretty sure it's in the datasheet ... somewhere.
Lord knows it can be hard to find stuff in those
things.

I don't have a datasheet handy, or I'd look it up.

HTH
I've Googled till I need glasses but I'll be darned if I can locate the
official Microchip document that specifically states the definition of
this (and all other) port register commands.
 
Winston wrote:

I believe this function means 'invert the value on this PORTD pin'.

I've Googled till I need glasses but I'll be darned if I can locate the
official Microchip document that specifically states the definition of
this (and all other) port register commands.

Didn't find it in the MX32 Family Data Sheet or the assembly 'quick
reference' cards.
Didn't find it in the MIPS website.
Didn't find it in any C32 compiler reference documents.
Didn't find it at http://www.microchip.com

Found a tantalizing clue on page 20 of in Microchip's
PIC32MX USB Starter Board User’s Guide :
http://ww1.microchip.com/downloads/en/DeviceDoc/61150C.pdf

Can you please point me to the Microchip document that defines
these kinds of port control commands for the MX32 parts?

With examples? :)


Thanks and Happy Friday.

--Winston
Yes, that is what it is. I've been looking at that new family of chips
myself. Most of the uC lines have a function like that to save code
space. You can still perform that with an XOR function.

Some compilers will make you think you have a low level function like
that, but all they are doing is generating pseudo code in the back
ground to invert it.

A good compiler will have some nice macro's per chip that helps you
greatly in code generation and clarity however, you really should open
the header file that contains these macros to see what resources it is
using. It has been the cause of many errors of registers getting
corrupted in your code because a use of a macro.

Also, some macro's are written with this in mind and may actually
generate more code then needed. So a good coder will have a quick access
of the file to remind them of what to be on the look out for.


Jamie
 
On Fri, 01 Jun 2012 09:56:05 -0600, Randy Day wrote:

In article <jqalv60mov@news1.newsguy.com>, Winston@Bigbrother.net
says...

I believe this function means 'invert the value on this PORTD pin'.

It's not a function; it's the name of a register you put a value into.
If you put 0x00000001 into LATDINV, LATD[0] gets TOGGLED(1-0, 0-1),
rather than SET or CLEARED. Same with any bit in an INV register; the
corresponding bit in the actual register gets XOR'd with it.

I'm pretty sure it's in the datasheet ... somewhere. Lord knows it can
be hard to find stuff in those things.
YES! Thank you, Randy! I was going nuts there.

Armed with your information I found the register definition in
Microchip's PIC32 Family Reference Manual (61120E.pdf)
http://ww1.microchip.com/downloads/en/DeviceDoc/61120E.pdf

(Not the 1156G.pdf "Family Data Sheet"!):

61120E.pdf:
12.2.3 Registers for Configuring Latch Functions (LATx)
12.2.8 SET, CLR, and INV I/O Port Registers


Much appreciated.

--Winston
 
On Fri, 01 Jun 2012 12:34:37 -0400, Jamie wrote:

Winston wrote:

I believe this function means 'invert the value on this PORTD pin'.

I've Googled till I need glasses but I'll be darned if I can locate the
official Microchip document that specifically states the definition of
this (and all other) port register commands.
(...)

Thanks and Happy Friday.

--Winston
(...)

A good compiler will have some nice macro's per chip that helps you
greatly in code generation and clarity however, you really should open
the header file that contains these macros to see what resources it is
using.
That's how I uncovered the register name. The trail ended only two levels
in. 'plib.h' referred to 'ports.h' which referred to LATDINV.

It has been the cause of many errors of registers getting
corrupted in your code because a use of a macro.
Luckily in this case at least, it is 'bare metal' control; not really a
macro.

Also, some macro's are written with this in mind and may actually
generate more code then needed. So a good coder will have a quick access
of the file to remind them of what to be on the look out for.

OK thanks!

--Winston
 

Welcome to EDABoard.com

Sponsor

Back
Top