User Tools

Site Tools


info:avr32_gpio_writing

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
info:avr32_gpio_writing [2009/04/29 09:56] tomgeeinfo:avr32_gpio_writing [2009/04/29 09:59] (current) tomgee
Line 58: Line 58:
     pm_configure_clocks(&osc);      pm_configure_clocks(&osc); 
    
 +
 +You can set and reset the port pins directly. Here is an example for PORTB:
 +Code:
 +volatile avr32_gpio_port_t *gpio_port_b = ( volatile avr32_gpio_port_t * ) &gpio_base->port[1];
 +   
 +gpio_port_b->ovrc = 0x00000001; // Clear PORTB0
 +gpio_port_b->ovrs = 0x00000001; // Set PORTB0
 +
 +
 +===== Setting PIO Faster =====
 +
 +This is faster, because you don't have to call a function (saving and restoring of all registers => stack).
 +
 +If you want to set or reset a pin of PORTA:
 +
 +    volatile avr32_gpio_port_t *gpio_port_a = ( volatile avr32_gpio_port_t * ) &gpio_base->port[0];
 +   
 +    gpio_port_a->ovrc = 0x00000001; // Clear PORTA0
 +    gpio_port_a->ovrs = 0x00000001; // Set PORTA0
 +
 +
 +You can also set or reset more than one pin at the same time. 
info/avr32_gpio_writing.1241013418.txt.gz · Last modified: 2009/04/29 09:56 by tomgee