Forum Discussion
Altera_Forum
Honored Contributor
21 years agoWrite in I/O ports
Hello, I want to write from my aplication in eCos only a bit, or led in the I/O ports in Nios II for mesure the timing latency. Can someone help me please? I don't know do this, and I don't find any documentation about.
Thanks, Guillem1 Reply
- Altera_Forum
Honored Contributor
For my test I use :
# include <cyg/hal/io.h> unsigned char ledpio; myfunct() { IOWR(LED_PIO_BASE,0, 1); // 1 for bit 0 ................. IOWR(LED_PIO_BASE,0, 0); // or ledpio = ledpio|4; // 4 for bit 2 IOWR_8DIRECT(LED_PIO_BASE , 0, ledpio); .............. ledpio = ledpio&~4; IOWR_8DIRECT(LED_PIO_BASE , 0, ledpio); } LED_PIO_BASE is defined in cyg/hal/system.h for my project