473,665 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

repeated readings

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

Thanks!

Jan 22 '07 #1
5 1289
"Lowell" <lo****@katamai l.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[]="ABCDEFGHIJKLM NOPQRSTUVWXYZab cdefghijklmnopq rstuvwxyz.\
\n",*q="kl BIcNBFr.NKEzjwC IxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+= strchr(p,*q++)-p;if(i>=(int)si zeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
Jan 22 '07 #2
Lowell wrote:
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.progr ammer.

Jan 22 '07 #3

"Ben Pfaff" <bl*@cs.stanfor d.eduha scritto nel messaggio
news:87******** ****@blp.benpfa ff.org...
"Lowell" <lo****@katamai l.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[]="ABCDEFGHIJKLM NOPQRSTUVWXYZab cdefghijklmnopq rstuvwxyz.\
\n",*q="kl BIcNBFr.NKEzjwC IxNJC";int i=sizeof p/2;char *strchr();int
putchar(\
);while(*q){i+= strchr(p,*q++)-p;if(i>=(int)si zeof p)i-=sizeof
p-1;putchar(p[i]\
);}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...
Jan 22 '07 #4
Lowell wrote, On 22/01/07 18:56:
"Ben Pfaff" <bl*@cs.stanfor d.eduha scritto nel messaggio
news:87******** ****@blp.benpfa ff.org...
>"Lowell" <lo****@katamai l.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[]="ABCDEFGHIJKLM NOPQRSTUVWXYZab cdefghijklmnopq rstuvwxyz.\
\n",*q="kl BIcNBFr.NKEzjwC IxNJC";int i=sizeof p/2;char *strchr();int
putchar(\
);while(*q){i+ =strchr(p,*q++)-p;if(i>=(int)si zeof 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.embed ded, 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
Jan 22 '07 #5

Lowell wrote:
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

Jan 23 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
10578
by: Leif K-Brooks | last post by:
How do I make a regular expression which will match the same character repeated one or more times, instead of matching repetitions of any (possibly non-same) characters like ".+" does? In other words, I want a pattern like this: >>> re.findall(".+", "foo") # not what I want >>> re.findall("something", "foo") # what I want
0
625
by: Wolfgang Lipp | last post by:
From: Lipp, Wolfgang Sent: Tuesday, 27?January?2004 13:26 <annotation> the first eleven contributions in this thread started as an off-list email discussion; i have posted them here with the consent of their authors. </annotation>
15
1504
by: Robert Sturzenegger | last post by:
// Code sequence A for (int i = 0; i < 10; ++i) { int k = something(); // some more code which uses k } // Code sequence B int k; for (int i = 0; i < 10; ++i) { k = something();
2
1339
by: RingTone | last post by:
SQL Server 2000/Access 2000 linked tables PK = FLOOR/DESK NO/TYPE A User has complained about seeing data below simply by scrolling through the attached table, the data is there when you look at the table using Query Analyser...... any idea's ? Example of repeated and missing rows - 109 - 112 are missing, whilst 113-116 are repeated. Happy to show Tony but I haven't experience rows shifting before my eyes recently!!
1
1860
by: Alec MacLean | last post by:
Hi, Outline of problem: I've built a set of user controls that are used to output questions for a survey and gather the responses using simple radio buttons. I'm adding an optional textbox to the question control to allow individual typed responses per question. I've got a maximum length to enforce which matches the underlying data table design.
3
1369
by: IraqiAli | last post by:
ok i have a couple of textboxes. The user is required to input values from 1 to 6 into those boxes. and submit it, those values would then go into an array. What i need to do is do checks to make sure that there are no invalid inputs. Ive dont a check to make sure no boxes are left empty and now i need to do a check to make sure the user doesnt input repeated values. basically they can enter 1, 2, 3, 4, 5, 6 they cant enter ...
7
1674
by: bagelman | last post by:
Hi, I have a string Array. Its length is 100. I want to search the array to find repeated strings in it. And after finding repeated strings I want to write to screen which word repeated how many times.. I thought that 2 array is necessary (one for storing repeated word the other is for storing repetition number) for this. But I couldn't write the code. Please give me some hints about it. Thanks...
7
3505
by: mcha226 | last post by:
Hi All I have to build a page which includes a select element (as a drop down menu) with all the country names in it. However I just found out that the need to be repeated many times so the client can select as many country as they can in their around the world trip planning. I don't want to repeat this long list multiple times, because I want to save bandwidth. Is there a more efficient way to do this rather than using JavaScript to...
1
1238
by: phanigamini | last post by:
Hi, I have a column like product name where in i want to retrive repeated words in the same row. Ex: Table Name: product_tbl Column Name: productname data: xyz and abc and ltd Here the word and is repeated twice.
9
2991
by: C#_Help_needed | last post by:
I need help with the following question. THANKS :) Write a program in c# that takes in a directory as a command line parameter, and returns the longest repeated phrase in ALL text files in that directory. Assume that all contents of all the files may be held in memory at the same time. Do not use unsafe code blocks and/ or pointers.
0
8438
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8779
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4356
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.