Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
recloop
PostPosted: Mar 13, 2012 - 12:04 PM
Rookie


Joined: Mar 12, 2009
Posts: 27


Quick question: is there any software method for inverting the output of the xmega USART modules? I am using an IR module which requires signals of the opposite polarity from normal (ie idle needs to be low, active high). I know that I could use a hardware inverter or a software serial library, but this seems like the kind of thing Atmel might have put in somewhere. I'm using the ATxmega16D4 chip to be precise.

Thanks!
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Mar 13, 2012 - 12:10 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 71278
Location: (using avr-gcc in) Finchingfield, Essex, England

Every port pin has a PINnCTRL register containing an INVEN bit - does this come into effect even when the port is being used for UART (I think I read somewhere that it would allow for inversion in any circumstance).

EDIT well it certainly says INVEN can invert the output when a pin is driven by a Waveform Generator (WG) in a timer - so I'm guessing it might work for UART too - I'm guessing it's an inversion gate right before the output.

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
condemned
PostPosted: Mar 13, 2012 - 03:44 PM
Hangaround


Joined: Sep 04, 2007
Posts: 356
Location: Oxford (England)

Yup - setting the INVEN bit works to invert the output of the USART (tested on 32A4 and 32D4's).
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
recloop
PostPosted: Mar 13, 2012 - 05:10 PM
Rookie


Joined: Mar 12, 2009
Posts: 27


That did the trick! Thanks for the help.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits