[En-Nut-Discussion] Nut/OS I/O register access on sam9260
a_funk80 at yahoo.de
Mon Jun 9 18:16:01 CEST 2008
Hello, my name is Artur and i come from Berlin/Germany. Sorry for my dummy english but i will try to describe my problem by the best way. I am new with ARM µC an Nut/Os and this ist my first try. I have allready installed Eclipse with yagarto and the sample project works fine. I tried the LED example and ist was very easy to setup this project on a olimex sam9260 board. Now i want to try to read some pins. I this case i want use the user button which is connected to PORTC and Pin15 (with a pull-up on board). The register access happents with inr see my code:
u_long baud = 115200;
unsigned int val;
* Register the UART device, open it, assign stdout to it and set
* the baudrate.
NutRegisterDevice(&DEV_DEBUG, 0, 0);
freopen(DEV_DEBUG_NAME, "w", stdout);
_ioctl(_fileno(stdout), UART_SETSPEED, &baud);
printf("\n Nut/OS Version: %s", NutVersionString());
printf("\nCPU running at %lu Hz", NutGetCpuClock());
val = inr(PIOC_PDSR);
val = (val & 0x8000);
puts("\n Button pressed");
printf("\n Value: %i", val);
The code gets compiled without of any errors but the button seems to be pressed allways. Can me help someone and tell me what problems they are?
Further i want access 8 Bits from left side of portB (31 down to 24). Can somebody provide me some examples, how to read more as one bit of a port at the same time and to write to this at the same time?
Thx u all.
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
More information about the En-Nut-Discussion