- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Hello,
I am new to Nios and was wondering if someone could help me figure out what I am doing wrong pointing to the interval timer. I have read the Embedded Peripherals section on it multiple times and it has not helped. I used pointers as opposed to using IRQs, becuase thats how the LED example was, I am trying to eventually create a program that has a Real time sampling interval, because I will be adding an ADC next. I have been adding the components one at a time to understand their functionality and properly use them. If I have a wrong approach for the leads with pointers please correct me as well. I had the leds working with a counter. I was trying to just check and reset the status register for the interval timer so that I could have it update the leds on the timers cycle. I know there are code examples, but writing my own and working through it is the best way to learn, I just got stuck and wasn't sure why this approach was not working when it did for the leds. Thanks a bunch
# include <stdio.h># include <system.h>
int main()
{
int* led= (int *)PIO_0_BASE; // air pio pins into the regulator
int* timer_status= (int *)TIMER_0_BASE;
int count=0;
*led=0x3;
while(1)
{
if(*timer_status==0x1)
{
*timer_status=0x0;
if (count==0) {
*led=0x3;
//*air=0x3;
count=1;
}
else if (count==1) {
*led=0x2;
count=2;
}
else if (count==2) {
*led=0x1;
count=3;
}
else if (count==3) {
*led=0x0;
count=0;
}
}
}
return 0;
}
- Etiquetas:
- Nios® II Embedded Design Suite (EDS)
Enlace copiado
1 Responder
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
So I did a lot of reading and learned a bunch about the HAL which didn't help me. I found out that to fix my code I have to keep telling the counter to start after it finishes. Is there a way to make it just keep recounting in Platform designer/Qsys? I thought that was the default setting already.

Responder
Opciones de temas
- Suscribirse a un feed RSS
- Marcar tema como nuevo
- Marcar tema como leído
- Flotar este Tema para el usuario actual
- Favorito
- Suscribir
- Página de impresión sencilla