From: Dave H. <dhy...@gm...> - 2008-01-30 01:30:28
|
Hi Justin, On Jan 29, 2008 5:21 PM, Justin Rajewski <ju...@ra...> wrote: > > I have a H-brige driver on portc pins 0-4. I need to set pin 4 to enable the > driver and set pin 0 and 2 to 5v and pin 1 and 3 to 0v. > I have used PIC microcontrllers but never Atmel. > To do this I would need to set all pins on portc to output with > i2c-io 0x0b setdir c.x 0 > is that right? On the AVR 0=in, and 1=out. It's easier to do: i2c-io 0x0b setdir c.0 out i2c-io 0x0b setdir c.1 out i2c-io 0x0b setdir c.2 out i2c-io 0x0b setdir c.3 out i2c-io 0x0b setdir c.4 out Alternatively, you could set pins 0-4 as output and 5-7 as input by doing: i2c-io 0x0b set DDRC 0x1F > Then I can set the pin state with > i2c-io 0x0b set c.x x > correct? Yeah - once the pin is set as output. Then this will toggle that particular pin. -- Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/ |