ts-7000
[Top] [All Lists]

[ts-7000] Timer 1 periodic interrupt

To:
Subject: [ts-7000] Timer 1 periodic interrupt
From: "lotsi01" <>
Date: Thu, 16 Mar 2006 19:46:54 -0000
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/
 


<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU