Hi all,
I want to write a program that uses the interrupt from timer 1 to,
for example, increase a counter. I have been reading the EP9301 User
Guide and the messages in this group, but I can't figure out how to
do it. So far I think I have managed to get the timer to work, but as
for the interrupt, I'm stuck. I'm new to embedded programming so a
small example program would really be helpful.
My program for timer 1:
#include<unistd.h>
#include<sys/types.h>
#include<sys/time.h>
#include<sys/mman.h>
#include<stdio.h>
#include<fcntl.h>
int main(int argc, char **argv)
{
int i;
int Value=0;
unsigned int *t1Load, *t1Control, *t1Value;
unsigned char *start;
int fd = open("/dev/mem", O_RDWR);
start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED,fd,
0x80810000);
t1Load = (unsigned int *)(start + 0x00);
t1Control = (unsigned int *)(start + 0x08);
t1Value = (unsigned int *)(start + 0x4);
//Loading start value
*t1Load=20000;
//Enable timer
*t1Control=0xC0;
//Print it:
for(i=0;i<65000;i++)
{
// Get a value
Value = *t1Value;
printf("%d\n", Value);
}
printf("Done\n");
//Disable Timer
*t1Control=0;
close(fd);
return 0;
}
The TS-7250 is not very responsive after I have run this program,
maybe it has something to do with some unhandled interrupt. Any help
would be appreciated.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|