[En-Nut-Discussion] Olimex SAM9-L9260 board
af_80
a_funk80 at yahoo.de
Tue Jun 10 13:18:18 CEST 2008
I doesn' works. Here is the complete code for this example:
#include <compiler.h>
#include <cfg/os.h>
#include <stdio.h>
#include <io.h>
#include <dev/board.h>
#include <sys/thread.h>
#include <sys/timer.h>
#include <sys/event.h>
#include <dev/twif.h>
#include <dev/irqreg.h>
void Led1Off(void)
{
outr(PIOA_OER, _BV(6));
outr(PIOA_SODR, _BV(6));
NutSleep(500);
}
void Led1On(void)
{
outr(PIOA_OER, _BV(6));
outr(PIOA_CODR, _BV(6));
NutSleep(500);
}
int main(void)
{
u_long baud = 115200;
NutRegisterDevice(&DEV_DEBUG, 0, 0);
freopen(DEV_DEBUG_NAME, "w", stdout);
_ioctl(_fileno(stdout), UART_SETSPEED, &baud);
printf("\nNut/OS Version: %s", NutVersionString());
printf("\nCPU running at %lu MHz", NutGetCpuClock()/1000000);
printf("\nProgram loaded...\n");
outr(PIOC_PER, _BV(15)); //enable pio control
outr(PIOC_ODR, _BV(15)); //set pin as input
for(;;)
{
if((inr(PIOC_PDSR) & _BV(15)) ? 1 : 0)
{
Led1Off();
}
else
{
puts("\n Button pressed");
}
Led1On();
Led1Off();
}
}
The LED's are blinking all the time but the reading from pin produce no
action. I tried thes sample also with ext-header connector on port_pin pb22
also not successful :(
I don't know about this problem, maybe Ethernut requires that peripheral
should be explicit disabled before using of gpio ?
--
View this message in context: http://www.nabble.com/Olimex-SAM9-L9260-board-tp17717279p17752980.html
Sent from the MicroControllers - Ethernut mailing list archive at Nabble.com.
More information about the En-Nut-Discussion
mailing list