Lowell wrote, On 22/01/07 18:56:
"Ben Pfaff" <bl*@cs.stanford.eduha scritto nel messaggio
news:87************@blp.benpfaff.org...
>"Lowell" <lo****@katamail.comwrites:
>> 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[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\
\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[i]\
);}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.
--
Flash Gordon