No exact or substring matches. trying for part
PICList
Thread
'[PICLIST] [OT] How to do timing in a VC++ windows '
2001\01\07@135931
by
Chris Eddy
|
Friends;
I ahve been beavering away at a few windows programs. I have some of
the ground rules down, but the amount of knowledge that you have to have
for MS VC++ is simply overwhelming. Some of my favorite embedded tricks
are simply invalid. I am still using V1.52, which made 16 bit apps. My
problem is that I need to do some fairly sophisticated serial comms
message timing. I know how to setup a timer in Windows, but the
resolution is horible. My favorite embedded trick of letting the
interrupt tick off a timer, and sit and wait for the proper time to
expire, throws windows into fits. First, I have no fast int timer to
rely on. Second, you are not allowed to sit and wait in windows. It
packs up the whole program and you have to shut down the program to
recover ( I still develop in Win3.1, which altogether crashes the
machine).
I need to know more strategies for program architecture and timing, and
I am tired of going to the bookstore and seeing an endless row of books
that explain how a window will inherit certain features. I need to get
past that.
Does anyone have suggestions for references on timing methods, or
possibly switching over to doing a DLL, or does someone have any quick
advice on how to get through this brief emergency.
Thanks!
Chris Eddy~
--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads
2001\01\07@180521
by
Bob Ammerman
1: Read up on 'multimedia timers' in Win31
2: Move up to Win32 and use multiple threads, and event flags.
Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)
{Original Message removed}
2001\01\08@084635
by
Alan B. Pearce
>Does anyone have suggestions for references on timing methods, or
>possibly switching over to doing a DLL, or does someone have any quick
>advice on how to get through this brief emergency.
I have programmed in VB3 on Win3.1 and know from bitter experience that the
timer resolution is 55mS - despite being able to specify the time in 1mS steps.
I assume VC is the same fort the same reason - it uses the standard tier
hardware without reprogramming it.
To do better than this you will need to have some sort of hardware timer card
that will generate an interrupt at the time or rate you need. However do also be
aware that if the time is too short (rate too fast) your program will not get
anything useful done (unless you run on a very fast processor) because of the
windows overhead.
--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics
2001\01\08@090925
by
Roman Black
|
Alan B. Pearce wrote:
>
> >Does anyone have suggestions for references on timing methods, or
> >possibly switching over to doing a DLL, or does someone have any quick
> >advice on how to get through this brief emergency.
>
> I have programmed in VB3 on Win3.1 and know from bitter experience that the
> timer resolution is 55mS - despite being able to specify the time in 1mS steps.
> I assume VC is the same fort the same reason - it uses the standard tier
> hardware without reprogramming it.
>
> To do better than this you will need to have some sort of hardware timer card
> that will generate an interrupt at the time or rate you need. However do also be
> aware that if the time is too short (rate too fast) your program will not get
> anything useful done (unless you run on a very fast processor) because of the
> windows overhead.
Not so, the PC has a PIT (programmable interrupt timer
chip) that has ticks at 1.194MHz or abouts, this is
readable by accessing one port, and can be programmed
to give fine timing interrupts. And you don't even have
to program it, just read it's current tick value.
For my high res timing in my PC programs I just
read (and poll) the PIT ticks, this is non invasive
and with one simple port read and subtract you get
exact time delay. I did 3 years as a PC games graphics
programmer and lived by the PIT chip.
I still live by the PIT chip now in my C programs
that use the high res timing to control/measure data
from the parallel port. :o)
Just do a web search for "8086 PIT programming" or
something, should bring up some data.
-Roman
--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics
2001\01\08@092422
by
Alan B. Pearce
>For my high res timing in my PC programs I just
>read (and poll) the PIT ticks, this is non invasive
>and with one simple port read and subtract you get
>exact time delay. I did 3 years as a PC games graphics
>programmer and lived by the PIT chip.
>I still live by the PIT chip now in my C programs
>that use the high res timing to control/measure data
>from the parallel port. :o)
Under Windows??? I am aware of the PIT chip and the methods involved for
reading it, but to try and use this method to drive events in an event driven
program would be, well interesting...
--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics
2001\01\08@094310
by
Roman Black
|
Alan B. Pearce wrote:
>
> >For my high res timing in my PC programs I just
> >read (and poll) the PIT ticks, this is non invasive
> >and with one simple port read and subtract you get
> >exact time delay. I did 3 years as a PC games graphics
> >programmer and lived by the PIT chip.
>
> >I still live by the PIT chip now in my C programs
> >that use the high res timing to control/measure data
> >from the parallel port. :o)
>
> Under Windows??? I am aware of the PIT chip and the methods involved for
> reading it, but to try and use this method to drive events in an event driven
> program would be, well interesting...
Ha ha! Who the heck in their right mind would
want to try and get high performance out of an
"event driven" environment!! ;o) No, I program
high perf stuff in dos C, and they run perfect
under a dos boot and pretty darn good under Win95.
I have some freq/period measuring stuff I use all
the time because I coded averaging and crude data
logging in it, and surprisingly under Win95 it's
not too bad at freq up to 10kHz. Notice I said
"averaging" as Win chews timeslice but it doesn't
often miss a pulse. But it only takes a few seconds
to "restart in msdos mode" :o)
-Roman
--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics
2001\01\08@102145
by
Bob Ammerman
Windows _does_ provide for better resolution than 55ms. You just have to use
the right calls to do it.
Look up "multimedia timers".
(of course, you can't _depend_ on Windows getting back to you in a timely
manner, tho' it _usually_ does).
Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)
--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics
2001\01\09@115144
by
Mitchell D. Miller
|
Chris,
I _may_ be able to help. I do most of my Windows tool development in Visual
C++ (although I don't do a lot with the ++ part <g>). When you do windows
development, you don't want to create wait loops that do polling, since
they'll quickly use all the processor time and not give other apps
sufficient time to do their work, ultimately crashing Windows. You have to
wait on an object, of which there are several. For example, in the app. I'm
working on currently, I create an Event with the CreateEvent() function.
Then, one thread calls WaitForSingleObject() which suspends the thread until
the Event is signaled by another thread (which could be a Windows thread ...
not necessarily another thread I spawned).
What is the nature of the timing you're doing? If you're waiting for data
to be received, you can tell Windows to signal your event when serial data
is received, which will cause your "waiting" thread to be released, which
could process the received data.
-- Mitch
P.S. I work in a purely WinNT/2k environment, so some of my techniques may
not work with 95/98.
{Original Message removed}
2001\01\09@120131
by
Mitchell D. Miller
Just remember, when considering multiple threads, that a single processor
can only perform a fixed amount of work in a single unit of time. Having
multiple threads will not get your work done any faster than a single
thread. However, when the nature of your computing requires waiting on
something (such as an event) and you have other work that can be done at the
same time, threads are a great way to go.
For example, I have one application that tests the availability of remote
PCs on the network. If each ping response takes 1 second (just as an
example), and 15,000 PCs are done one after the other (yes, we have 15,000
Pcs on our nationwide network), it would take a minimum of 4 hours to ping
them all. However, if I can have 100 threads all simultanesously working
(and waiting as needed), the same job could be done in (theoretically) 0.04
hours (subject to network throughput, etc.).
-- Mitch
{Original Message removed}
2001\01\09@131756
by
rich+piclist
|
Multiple threads to do the same thing through the same resource? If you
use socket(PF_INET, SOCK_RAW, IPPROTO_ICMP), you might be able to send
15000 pings then await 15000 responses? ...er, maybe Windows doesn't do
raw...
{Quote hidden}> Date: Tue, 9 Jan 2001 11:00:02 -0600
> From: Mitchell D. Miller <
spam_OUTmdmiller2TakeThisOuT
HOME.COM>
> Reply-To: pic microcontroller discussion list <
.....PICLISTKILLspam
@spam@MITVMA.MIT.EDU>
> To:
PICLIST
KILLspamMITVMA.MIT.EDU
> Subject: Re: [OT] How to do timing in a VC++ windows program??
>
> Just remember, when considering multiple threads, that a single processor
> can only perform a fixed amount of work in a single unit of time. Having
> multiple threads will not get your work done any faster than a single
> thread. However, when the nature of your computing requires waiting on
> something (such as an event) and you have other work that can be done at the
> same time, threads are a great way to go.
>
> For example, I have one application that tests the availability of remote
> PCs on the network. If each ping response takes 1 second (just as an
> example), and 15,000 PCs are done one after the other (yes, we have 15,000
> Pcs on our nationwide network), it would take a minimum of 4 hours to ping
> them all. However, if I can have 100 threads all simultanesously working
> (and waiting as needed), the same job could be done in (theoretically) 0.04
> hours (subject to network throughput, etc.).
>
> -- Mitch
>
>
> {Original Message removed}
2001\01\09@144224
by
Bob Ammerman
----- Original Message -----
From: <rich+.....piclistKILLspam
.....LCLOGIC.COM>
To: <EraseMEPICLISTspam_OUT
TakeThisOuTMITVMA.MIT.EDU>
Sent: Tuesday, January 09, 2001 1:16 PM
Subject: Re: [OT] How to do timing in a VC++ windows program??
> Multiple threads to do the same thing through the same resource? If you
> use socket(PF_INET, SOCK_RAW, IPPROTO_ICMP), you might be able to send
> 15000 pings then await 15000 responses? ...er, maybe Windows doesn't do
> raw...
Yes, you can do this in Windows. (maybe not that exact syntax).
Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
More... (looser matching)
- Last day of these posts
- In 2001
, 2002 only
- Today
- New search...