|
merlinq12 wrote: I don't mind about the U/Led.
I don't know what you mean here, if you want to forgo the resistor chances are you will ruin your serial port, which will cost you more than thousands of resistors.
merlinq12 wrote: .I can run a stepper motor with this?
with the proper H bridge in place you can control motor steps, yes. However:
- there is bound to be some unpredictable delay between setting a control line in software, and getting the result at the end of the USB cable (a motherboard serial port is much better in this, it does not need a USB packet to transmit the command over a multi-device bus);
- a Windows PC would be unreliable in generating a smooth stepper motor sequence, as Windows has lots of overhead and isn't real-time at all.
The only good way to control moving equipment at the step level is by using a dedicated micro-controller, such as a PIC.
merlinq12 wrote: how to make a timer run 1.25ms , then 1.50ms , then 1.75ms
There is no way to do that reliably, unless you:
- replace the USB-to-RS232C cable by a motherboard port;
- and write a device driver (which can really run its code at a priority above all applications),
FWIW: moving parts that may harm a human being should not be controlled directly by a PC; always use a dedicated micro-controller, some micro-switches to detect out-of-order situations, and appropriate code.
PS: stop abusing the C# forum for something that is purely hardware oriented!
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Luc Pattyn thanks for your prompt response ... very nice and clean explanations (not very detailed but enough & strait forward). Thanks man.
And I Dont abuse anything, I was beginning the discussion from SerialPort class, and one thing to another I was jumping to other interesting stuff.
I see that I am away a bit from my original post, so I will no longer continue . I understand.
hmmm...nice talk with you...I can sleep tonight right.
thanks again and have a nice day.
~Teodor~
|
|
|
|
|
though ... I must put for others the !Finished! customized code :
using System.IO.Ports;
private SerialPort port = new SerialPort("COM3", 9600, Parity.Odd, 8, StopBits.One);
public Form1()
{
InitializeComponent(); port.Open();
}
private void buttonSS_Click(object sender, EventArgs e)
{
if (buttonSS.BackColor==Color.Transparent)
{
buttonSS.BackColor = Color.GreenYellow; port.DtrEnable = true;
timer1.Start();
}
else
{
buttonSS.BackColor = Color.Transparent;port.DtrEnable = false;
timer1.Stop(); label1ShowPort.Text = "Closed";
}
}
private void timer1_Tick(object sender, EventArgs e)
{
port.DtrEnable = !port.DtrEnable;
if (port.DtrEnable)
{
timer1.Interval = (int)numericUpDown1.Value;
label1ShowPort.Text = "sending...";
label1ShowPort.BackColor = Color.OrangeRed;
}
else
{
timer1.Interval = (int)numericUpDown2.Value;
label1ShowPort.BackColor = Color.DarkRed;
label1ShowPort.Text = "";
}
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
timer1.Interval = (int)numericUpDown1.Value;
}
|
|
|
|
|
Hello, I am using borderless form as main form. It has a menu bar associted with it.
The problem is that main for window is not focused by default.
Menus gets highlighted when i move mouse over it but they do not expand as i click on it. I need to click one more time to expand the menu.
What should i do so that form is activated as soon as it comes up.
Thanks in advance.
|
|
|
|
|
Call the Focus() method in your form loaded event.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I'm trying to think on best way to implant something, and i'm uncertain as to what approach should i take.
Background:
1. i have PCI card (digital I/O card) that can acquire up to 96 inputs (each input reads as '1' or '0').
2. I'm developing panel for that card, that will display for user 96 LEDs (each with name next to it) - led lit = 1, led not lit = 0.
3. panel update at runtime without need to press anything.
The first approach that comes to my mind is:
1. 96 LEDs are generated on form at runtime (each with line input name).
2. run via loop: run async function using BeginInvoke that read input x value, then invoke main thread to update LED to on/off (based on value we've just read).
Possible problems:
overhead / GUI update speed.
I was thinking if i could somehow make certain led "subscribe" to a bit change on some array that is updated with changes, and that could somehow auto-fire the event & control would just "toggle" itslef to 1/0 (without me needing to address him).
Now i guess i could use singleton to refrence inside the custom control (led + label), but is there any better alternative / approach I should use ?? (aiming for max performance)
|
|
|
|
|
There's no way I can see to 'subscribe' to a mythical event, unless the drivers for your card generate one. Polling could be your best bet. I've written input controllers for custom controllers that use the parallel port and I was able to poll them on a timer without hurting my UI performance.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
idan_bismut wrote: a bit change on some array that is updated with changes
No problem there, just have an array of 3 Int32 s, that will give you the 96 bits you require. Make sure the bits are only exposed (for changes) through an indexer or similar method and you can raise an event to update the UI in there.
As Christian said, if the hardware raises messages then you just need to catch those, otherwise polling is your only option. The API for the card will have that info.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hi
I get a equivalance in my program and i should create the chart of that equivalance.
how can i create the chart in windowsApplication.
please help me.
|
|
|
|
|
What is an equivalance ?
You either draw it yourself or you use a charting library. I believe Microsoft offer one now, and there's others about that are free, which I assume is your preference.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
client give me a equavilance and value of variable.
for example f(x)=x^2+4*x+cos(x); and x=30.
I download mschart and i want to work with it.
i need a tutorial and some example with it.
|
|
|
|
|
If x has a known value, how does this equate to a chart ? What is your client trying to do ?
I believe the word you want is 'equation'. Your client has given you an equation, but to draw a chart, you'd be drawing f(x) values against all possible values of x. Providing a value for x means you'll have a specific value for f(x), not a chart.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
let me change my question.
i want to create chart between two points?
for example i want to create chart between these two points: A(1,2) , B(3,6)
|
|
|
|
|
OK, so that's just a line between two points ? You're going to use the MSChart control ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
ya.
i want to use MSCHART and i need some help and some example for mschart control.
do you suggest easier way than MSCHART ?
|
|
|
|
|
The MSChart control documentation looks to me like it's pretty basic. However, I just realised it's a legacy COM control. Try this[^] instead.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Well, you could write some code and create your own chart control, then use that on your form.
Or you could look and see if anyone has already created one that would suit your purpose. For example here[^] is the Microsoft Charting Controls and there are many many more out there just waiting for someone to google or bing for them.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I have a Form with a few panels and a RichTextBox on it. I need to detect any key messages on the level of form and send them to other child controls on my own way. I tried calling/overriding WndProc, PreProcessMessage, etc. Also tried setting my own MessageFilter via Application.AddMessageFilter() and finally gave a try to a native method SendMessage. None of these work.
I CAN detect the messages. But the problem is that when I'm passing them to the RichTextBox there's no effect (no text is appended). How can I make that control react on the redirected messages?
Thanks in advance.
|
|
|
|
|
Why can't you do it on the level of keydown, keypress and keyup messages ?
Why can't you just detect a keydown and pass the focus to the control ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Firstly, when a key is pressed, I need to add a char to the textbox, even if it does NOT have focus. Then, when I press a key, the keydown event is obviously not detected by the textbox. The same with the form! There is no info about this event. I could use PreviewKeyDown, but I couldn't mark the message as used/handled.
Secondly, the form should distribute the messages, not necessarily to the box. Maybe somewhere else, basing on other conditions.
|
|
|
|
|
Hi evry body.
I Have a Question about error in Asp.net with c#.
i get error " Unable to luanch the ASP.NET develpment server"
Please help me!!
thank you
|
|
|
|
|
Where to start...
1 - we HAVE an ASP.NET forum
2 - The error means the server can't launch, it's a setup problem, not a coding problem.
3 - based on what you've said there's little to no chance that anyone can help.
Why don't you copy and paste the actual error message, with all the details given, so we can try to work out what is going on ? What version of Visual Studio are you using ? I assume this happens when you press F5 ? Do you have IIS installed ( you don't need it, but it would be interesting to know if it works and the ASP.NET server doesn't.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
hi
you are very good. since helpe me.
thank you very much
|
|
|
|
|
I am trying to check a checkBox in CheckBoxList using .Selected = true property,
But not working dont know why but changes are not getting reflected On UI.
Could you please help me out in this.
Thanks in Advance.
Truth Is The Simplest !!!!
|
|
|
|
|
its not nessesary to do it by writitng code because the checkboxlist has a build in property MultiColumn to set it TRUE
Qendro
|
|
|
|