Thread View: comp.lang.misc
3 messages
3 total messages
Started by W Geake
Tue, 15 Dec 1992 14:47
Accurate Timing in Visual Basic
Author: W Geake
Date: Tue, 15 Dec 1992 14:47
Date: Tue, 15 Dec 1992 14:47
13 lines
1084 bytes
1084 bytes
In order to run an analogue to digital convertor module from a serial port, I want to send a byte from the port every 10 ms. This sets the sampling rate, so the accuracy of the interval is very important. The VB Programmer's Guide mentions BUILT IN POTENTIAL FOR ERROR in timer controls, a great euphemism if ever I heard one. Can I get good precision from VB, or do I need to work in C (please not!) or C++(worse still) or write a VxD (I'd rather sell life insurance)? All ideas gratefully received: unlimited fame more or less guaranteed for useful ones. Thanks in advance, O Wise Ones. Bill Geake, University of Edinburgh, Scotland. Internet: wbg@ee.ed.ac.uk or W.Geake@festival.ed.ac.uk
Re: Accurate Timing in Visual Basic
Author: john r strohm
Date: Tue, 15 Dec 1992 15:52
Date: Tue, 15 Dec 1992 15:52
23 lines
1940 bytes
1940 bytes
In article <29569@castle.ed.ac.uk> wbg@festival.ed.ac.uk (W Geake) writes: >In order to run an analogue to digital convertor module from a serial >port, I want to send a byte from the port every 10 ms. This sets the >sampling rate, so the accuracy of the interval is very important. The >VB Programmer's Guide mentions BUILT IN POTENTIAL FOR ERROR in timer >controls, a great euphemism if ever I heard one. Can I get good precision >from VB, or do I need to work in C (please not!) or C++(worse still) or >write a VxD (I'd rather sell life insurance)? Bill, you have a fairly hairy problem on your hands. In order to get that rate, you are going to have to grab one of the timers (probably the keyboard scan timer) and reprogram it to 100 Hz. Then you are going to have to install a custom interrupt handler to pump the serial port. And you STILL have to worry about DOS or something else taking over your machine for many milliseconds while it does something it thinks is more important. If I were in your shoes, I would grab a microcontroller or a single-chip microcomputer and dedicate it to pumping the ADC. If all you need is a pulse, just so the ADC module gets SOMETHING, then something like a Motorola 68HC705K1 would probably work just fine. If you need a real-live character, then an 8751 or something along those lines (68HC11, say) would work well. (Note: I am extremely fond of the New Micros Inc. F68HC11: it comes with Forth blown into the on-board ROM.)
Re: Accurate Timing in Visual Basic
Author: peter da silva
Date: Wed, 16 Dec 1992 23:56
Date: Wed, 16 Dec 1992 23:56
29 lines
1776 bytes
1776 bytes
In article <29569@castle.ed.ac.uk> wbg@festival.ed.ac.uk (W Geake) writes: > In order to run an analogue to digital convertor module from a serial > port, I want to send a byte from the port every 10 ms. This sets the > sampling rate, so the accuracy of the interval is very important. If you want to do something every 10 ms, on an IBM clone, you have to: 1. Write a device driver to do the work on a timer interrupt. 2. Deal with the standard timer interrupt, which runs at 18.2 Hz. a. Make it run faster and then emulate the standard speed for the rest of the system b. Install a secondary clock for the device driver. c. Use a video card that lets you work off the vertical blank interrupt and runs at 100 frames per second. Needless to say, you can't do this in Visual Basic, and doing it in C or C++ is going to require a lot of effort coercing the compiler to do the interrupt routine. I think you've got some assembler ahead of you. > (I'd rather sell life insurance)? I used to sell encyclopedias door to door, when I was at school. Is that anything like it? -- Peter da Silva `-_-' Ferranti International Controls Corporation 'U` Sugar Land, TX 77487-5012 USA +1 713 274 5180 "Zure otsoa besarkatu al duzu gaur?"
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads