repeated readings

L

Lowell

Hello,
i need to read from a variable every 'x' microseconds. Someone can help
me?

Thanks!
 
B

Ben Pfaff

Lowell said:
i need to read from a variable every 'x' microseconds. Someone can help
me?

Maybe you could explain what difficulty you're having. But I
should warn you, first, that the standard C language and library
don't provide much support for this kind of thing. You're likely
to need to resort to implementation-specific constructs, which
are more likely to be handled well by a newsgroup specific to
your implementation than by comp.lang.c.
 
S

santosh

Lowell said:
Hello,
i need to read from a variable every 'x' microseconds. Someone can help
me?

Thanks!

If you're developing under POSIX use the nanosleep() function. For
further details, since pure ISO C, the topic of this group, has no
reliable method for pausing program execution for microseconds,
followup in comp.unix.programmer.
 
L

Lowell

Ben Pfaff said:
Lowell said:
i need to read from a variable every 'x' microseconds. Someone can
help
me?

Maybe you could explain what difficulty you're having. But I
should warn you, first, that the standard C language and library
don't provide much support for this kind of thing. You're likely
to need to resort to implementation-specific constructs, which
are more likely to be handled well by a newsgroup specific to
your implementation than by comp.lang.c.
--
int main(void){char
p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int
putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof
p-1;putchar(p\
);}return 0;}



I use a DSP (ADSP 2181) and i must read from data bus and put the data into
array every 'x' microseconds. I believed that ansi C supported this
function...
Thanks however...
 
F

Flash Gordon

Lowell wrote, On 22/01/07 18:56:
Ben Pfaff said:
Lowell said:
i need to read from a variable every 'x' microseconds. Someone can
help
me?
Maybe you could explain what difficulty you're having. But I
should warn you, first, that the standard C language and library
don't provide much support for this kind of thing. You're likely
to need to resort to implementation-specific constructs, which
are more likely to be handled well by a newsgroup specific to
your implementation than by comp.lang.c.
--
int main(void){char
p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int
putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof
p-1;putchar(p\
);}return 0;}


Please don't quote people signatures (the bit after the "-- ") unless
you are commenting on them.
I use a DSP (ADSP 2181) and i must read from data bus and put the data into
array every 'x' microseconds. I believed that ansi C supported this
function...
Thanks however...

You believe wrong.

The C standards say that the implementation defines what you get when
casting an integer to a pointer, and this will probably get you part way
there if your "data bus" is mapped in to part of the address space you
can read. The volatile qualifier will also probably be needed, although
again the standards leave a significant amount about this implementation
defined. On the other hand, the standard will not help you at all with
the "every 'x' microseconds" bit of your problem.

You would probably be better off asking somewhere like
comp.arch.embedded, although if you don't show any sign of having made
some attempt and don't say what part you are having difficulty with I'm
not sure how helpful they will be.
 
R

Raman

Lowell said:
Hello,
i need to read from a variable every 'x' microseconds. Someone can help
me?

Thanks!
I think you can use signals...But, at the same time I will caution you
that It is not safe to use signals always.So it depends on your problem
you want to solve.

Regards,
Raman Chalotra
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top