|
write an onclick() handler for the radio buttons and do ur logic there
"there is no spoon" biz stuff about me
|
|
|
|
|
Can u explain more detail how i use the logic to control motor run in different speed.....
|
|
|
|
|
What kind of motor is it? What are you using as a hardware controller? Did it come with a driver package? Is there an API for programming it? The method Lauren describes is simple enough, but we're working in the dark here. If you haven't got some kind of specific controller in mind, find one and provide some details. Nothing on your PC can directly control a motor (other than perhaps a single-speed dc motor connected to a line on a parallel port). For a dc motor you'll need at a minimum a D/A converter with a power amp. You'll probably also want an A/D converter with a tachometer on the motor for feedback, if the speed has to be regulated under load. For a stepper motor you'll need a stepper controller card, and you'll program it for a selectable step rate. A synchronous motor will need a programmable ac power supply to control it properly by varying the frequency. What are you using?
"Another day done - All targets met; all systems fully operational; all customers satisfied; all staff keen and well motivated; all pigs fed and ready to fly" - Jennie A.
|
|
|
|
|
In my project i just need counter clockwise dc motor with no load condition via parallel port. But what is the purpose of the D/A converter with power amp and how they control the motor run in different speed....
|
|
|
|
|
A DC motor, unless it is very tiny, draws more current than a parallel port can provide without burning out. DC motors are voltage controlled (not really, but it looks that way to the user), so you need a variable voltage to adjust the speed. An D/A converter takes a digital input and converts it into a dc voltage. An amplifier following it raises the voltage and provides the large current necessary to drive a motor. Crude versions of both are easy to design and build.
If the motor is very tiny you might try one of a couple of approaches. The simplest is to connect it to a line of the parallel port (with a small series resistance to protect the port) then output a pattern of bytes the alternates the ratio of 1's and 0's on the line to simulate a PWM signal. Another method would be to attach series resistances to all the lines, tie them together at the motor connection, then use a binary value to effectively switch resistances in and out of the circuit. Assuming that the parallel port is used to switch a powered motor to ground (line driver circuits can usually sink far more current than they can source), all 0's would create the lowest virtual resistance to ground, while all 1's would be effectively open.
I don't know what a modern port can handle in terms of current - they don't publish specs with PCs anymore. They used to use a TTL open-collector configuration which could sink about 100 mA, max. I doubt that they've increased that, more likely it's less these days.According to my reading of some troubleshooting manuals, the parallel ports are still TTL, a 5V logic family, so the spec is unlikely to have changed much. Note that a logic 1 signal must be applied to the SELECT pin for the port to send any data at all.
For the software to drive it you'll need to do some research. The parallel port uses much of the same stuff as a serial port. See "Using Communications Resources" in the Platform SDK for detailed information. You'll need to write a class for communicating with a parallel port with your motor connected to it, providing a function to change speeds which implements your preferred method of controlling the effective motor voltage, then your control program can call this function in response to a radio button selection. Sounds like fun, if hazardous to your PC - good luck!
"Another day done - All targets met; all systems fully operational; all customers satisfied; all staff keen and well motivated; all pigs fed and ready to fly" - Jennie A.
|
|
|
|
|
Hi
How can check if a CWnd object atteched to a valid handle?
I've tried this:
bool isValid = pWnd->GetSafeHwnd() == NULL;
but sometime GetSafeHwnd() returns me 0xfeeefeee
thanks.
|
|
|
|
|
try
isValid = IsWindow(m_hWnd);
Hope it Helps
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
thanks
|
|
|
|
|
Hi all,
I choose grey property for File menu item.
how can i un-grey it at run-time
Thanks all,
best regards,
|
|
|
|
|
I knw how to make a Win32 Dll and implicit link it with the Win32 client in Same directory. What are the steps involved in exporting a function to a VB client.And can VB client use it as simle C function
Rum + Whisky is very Risky
Cheers!!!!
Siddharth
|
|
|
|
|
Hi all,
i need to store the elements in the integer array from two different files in a buffer. Then i need to compare the elements in the arrays. How do i store the array into buffer.Thank you for all your help.
Ivory
|
|
|
|
|
i want to count no of controls added in my dialog window in VC++
|
|
|
|
|
EnumChildWindows should do the trick.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I am trying to write a Visual C++ program that takes Questions and Answers as input (Combo Box) and provides persistent storage in a file on a CD that contains the program. I want to call this program Notebook, because it is the form I like to take notes in - Questions - the Answers to which demonstrate knowledge of the subject matter. This program will be used for various study purposes. I eventually want to evolve the program into one that uses jpeg file pictures of plants with their names in the place of Questions and information being tested about them in the place of Answers. That one will be used by my wildlife biologist friend. Has anyone seen a good "go-by" for such a program?
The closest thing I have seen was in MFC/C++>>Combo and List Boxes>>Beginners by Wolfram Steinke as his CComboBox control demo.
|
|
|
|
|
1.I have a question: when i use UDP/IP protocol, sometimes I can receive the data,others are not,if I debug the program, I can receive the data without delaying,I dont know why it happend ,and I have no way to execute it;
2.The completionPort model adapats the UDP/IP protocol,or not?
|
|
|
|
|
are u using multicast udp?
if so remember a lot of routers block udp multicast packets
"there is no spoon" biz stuff about me
|
|
|
|
|
NO,I don't use the Multicast, I use the UDP/IP in the common C/S model, I want to recevie the data use the completionport,
for the chat,....
if you talk about the completionport ,pelease email me , I will send the code to you,
|
|
|
|
|
Hey all.
Just wondering, what would be the best way to find out what the user's windows directory is? (e.g, sometimes its c:\winnt, other times c:\windows, or whatever other ideas the user decides to come up with).
I want to be able to call (HH.EXE) which resides in the users system directory to launch my HtmlHelp files. I realize that I can simply call the .CHM file with shellexecute and that will launch it as long as the file type has been defined. But I want to be on the safe side in case that file type is not defined.
I preferably do not want to have to get the windows directory by accessing the environment variable "windir", but if that is the best way about it, I guess it'll suffice! If so, can someone tell me how to go about accessing this environment variable ... or if there is a better way, enlighten me?
Thanks
Shultas
|
|
|
|
|
I think that unfortunately this is one area you have to read the environment - you didnt say what O/S here, I'm assuming NT.. try this :-
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
char * sysdir = getenv("SystemRoot");
if (sysdir)
cout<<"value of SystemRoot is: "<< sysdir<
|
|
|
|
|
I dont know how accurate this info is, but I'm going to contradict myself and offer this link I found after a quick look see a-la-google (and I just learnt something for today, that there does appear to be some API's for it other than looking in the environment) ..
http://www.qinysoft.com/articles/vcdirectory.htm[^]
hth, 'G'
|
|
|
|
|
TCHAR szBuffer[MAX_PATH];
GetWindowsDirectory(szBuffer, MAX_PATH);
|
|
|
|
|
This is something I haven't mastered for some reason.
I am trying to count the number of elements in a one-dimensional array to loop through it so I figured it would be something like sizeof(array) / sizeof(array[0])
Unfortunately this always returns 1. The array consists of 12 longs (but it is empty to begin with and during the calculation. Do different rules apply to empty arrays, and what is the workaround)
Thanks.
|
|
|
|
|
The sizeof trick only works for staticly allocated arrays. It sounds like you're doing something like:
long* ptr = new long[12]; Since the type of ptr is long* , sizeof(ptr) is 4. ptr[0] is a long , and sizeof(long) is also 4. To do what you want, you would have to write:
long arr[12]; Now sizeof(arr) == 12*sizeof(long) == 48.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt
"Linux is good. It can do no wrong. It is open source so must be right. It has penguins. I want to eat your brain."
-- Paul Watson, Linux Zombie
|
|
|
|
|
I have declared the array staticaly in one function and then passed this empty array in another function (to fill it up) and it is in the second function that sizeof(arr) == 1...I don't understand it!
The function parameter list (2nd one goes something like this)
void(..., ..., long arr[])
{
...
}
|
|
|
|
|
That's because when you pass an array as function parameter, the function always receives a pointer just as if it were declared long* arr . You can't pass an entire array in C.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|