[En-Nut-Discussion] Questions

Вадим Владимирович vadx at mail.ru
Tue Apr 7 15:41:18 CEST 2009


Hello.
I'm a russian student.
I've some questions.
My application should use timer. I've close study of example "timers.c", and read Nut/OS help, but I don't understand some aspects.
This is my program.
Ethernut 3.0 Rev. E. Nut/OS 4.6.2. + WinARM.

How to start and to stop timer 1? I think it must be like this:

#include <cfg/os.h>
#include <cfg/clock.h>
#include <arch/arm.h>
#include <dev/irqreg.h>
#include <sys/timer.h>

Void main() {

//how to zero timer 1?
TC1_CV = 0x00; // is it right?

outr(TC1_CCR, TC_CLKEN); // start timer 1
delay(1000);
outr(TC1_CCR, TC_CLKDIS); // stop timer 1

// Can I calculate value of timer in seconds?
Int sec;
Sec = TC1_CV/1000; // is it right?
  
//also I have to use pin A of Timer1.
if(TC1_RA = 1) // check the value of pin A1 of Timer 1.
Else
+
// I don't know is it right. May be I should configure pin A1 of Timer 1 as input? How can I do it?
}

I would be very much obliged to you if you ask me.

Vadim.



More information about the En-Nut-Discussion mailing list