|
TJS4u wrote: the microcontoller will get the code which is downloaded to it thru the port and it will execute
You're sending "code" to the controller? I'm afraid I don't understand what you're saying here, can you give an example of the codes that you wanna send?
TJS4u wrote: after execution the result is send to the application thru the serial port from the microcontroller
..and the ReadLine() method will "hang" until the microcontroller sends this "enter"-character. I bet that the logger doesn't send it
It works if you remove that line, doesn't it?
|
|
|
|
|
Hi,
It is my impression this project is way beyond your current reach. Nevertheless here are some facts:
1.
transmit and receive channels are (almost) completely independent: there is a wire in each direction, there is separate electronics, separate data buffers, and different methods to call.
The only link exists inside the serial driver when software dataflow is used (XON/XOFF).
2.
whatever gets sent through a serial port is gone in a couple of micro- or milliseconds, you can't read it back; you can (if things go well) find the data at the target hardware after that delay.
Some suggestions:
1.
if all is new to you (C#, serial ports, microcontroller) you have zero probability to get it working by just setting it all up and hope for the best. You MUST go step by step, debug each step completely before taking the next step.
2.
The first step should be one of these (in increasing level of difficulty):
2a. use two PC's (I'll call them master and target) connect them through a serial cable WITH A NULL MODEM (which switches transmit and receive lines); run a terminal emulator (HyperTerminal, whatever) on the target PC, so you make it emulate your microcontroller by reading the emulator display and typing keys when appropriate. And run your own code on the master PC. Now you can first debug transmission: your program writing, the emulator showing what comes in; then you can tackle the receive side (with buffers, events, etc).
2b. you could try the same on a single PC (using two serial ports, connected with again a NULL MODEM); it is much less comfortable though.
2c. you don't even need real serial ports and a null modem cable, you can use a VIRTUAL NULL MODEM
(Google for com0com).
3. If all this works, you could try to use the microcontroller. If that one needs a program download, you'd better won't need its serial port for that, since it has not been debugged yet,
so it will not work initially.
Good luck.
|
|
|
|
|
how i open my form as open in .net by mouseover on properties,solution explorer etc.
i want to open form as when u add new form in .net in solution explorer i want create my strip and on a tab name say print on mouse over a form slide and show and on mouse out it slide again to left or right. i want to do in my mdi form
thanks.
send solution on sharma_diw@hotmail.com
modified on Tuesday, December 9, 2008 6:56 AM
|
|
|
|
|
You open a form by calling either .Show() or .ShowDialog() on the form object.
If you want to do it in the mouse over, you must add an event handler to the mouse over event, and show the new form from there.
Simon
|
|
|
|
|
Add a event on Mouseover that should open the form
Cheers!!
Brij
|
|
|
|
|
hello all
I want to write some data to a serial port and Read from the Port the data and display in a textbox ...
how can i do this
|
|
|
|
|
|
hello Simon Stevens
i treid the code below but nothing happens....
serialPort1.PortName = "COM1";
serialPort1.BaudRate = 9600;
serialPort1.DataBits = 8;
serialPort1.Parity = Parity.None;
serialPort1.StopBits = StopBits.One;
serialPort1.Open();
serialPort1.Write("A");
serialPort1.Close();
serialPort1.Open();
textBox1.Text = serialPort1.ReadLine();
|
|
|
|
|
TJS4u wrote: i treid the code below but nothing happens....
That is because you are not doing anything! What are you expecting? Do you know how to use a serial port?
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
hello leppie
my requirement is to connect a microcontrolelr to the serial port .
i tried this to see if data is in the buffer ... then it can't be read back
Thanks
|
|
|
|
|
What are you expecting to happen? You can't just write "A" to a serial port and then expect to read it back.
You need to have some hardware connected to the serial port that either responds to data, or transmits data in.
Simon
|
|
|
|
|
You can use SerialPort class in System.IO.Ports namespace for communicating with serial port. It provides various methods/event to read and write data.
|
|
|
|
|
hello
i treid the code below but nothing happens....
serialPort1.PortName = "COM1";
serialPort1.BaudRate = 9600;
serialPort1.DataBits = 8;
serialPort1.Parity = Parity.None;
serialPort1.StopBits = StopBits.One;
serialPort1.Open();
serialPort1.Write("A");
serialPort1.Close();
serialPort1.Open();
textBox1.Text = serialPort1.ReadLine();
|
|
|
|
|
Hi,
I think you are going in wrong direction. Serial port are buffered port and it has got two seperate data line, which are TX (Transmit) and RX(Receive). Now if you send any data to your serial port it's there in TX buffer. So which ever device connected to this serial port suppose to get that.
So, you want to see whether this code working for you or not. So do one thing. Get one RS232 connector and short both RX pin and TX pin. Now try the same code, it should work. This is called loopback mechanism in hardware style.
If you don't have this connector then there are few utility software which create virtual serial port and same utility can create loopback mechanism also. This is loopback in software style.
I am sure either of two approach should solve your problem. Please let me know if you still face issues.
Himadri
|
|
|
|
|
Seriously, aren't there enough articles about this topic here on CP?
That's what the search function is for.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi
I would like to draw an image that contains lines , text and rectangles.
In order to draw it I need to use the graphics object.
Also I would like window\control will handle scroll bar, drawing the image automatically in case the image move with the mouse for example, so I was thinking to use image object in order to store my image
How can I export the image I created manually from graphic object (after I create all the items I want such as line, rectangle, etc on panel for example) to image object?
Thanks
Ronen
|
|
|
|
|
You don't need to - just create a new Bitmap, the create a new graphics object, and draw to that
e.g. something like
Bitmap bmp = new Bitmap( 640, 480 );
using( Graphics G = Graphics.FromImage(bmp) )
{
G.FillRectangle(...);
}
|
|
|
|
|
OK Thank u all,
Itry to draw to bitmap and it work great
How can I display it in the form
Should I create picturebox control and load the bitmap to it?
I would like the form to create scroll bar automaticly if need (in case the form is smaller then the bitmap image)
Ronen
|
|
|
|
|
Hi,
you can create a Bitmap, obtain the corresponding Graphics (through Graphics.FromImage), paint
to your hearts content, then use Bitmap.Save
BTW: there are several articles about Paint-like apps here on CP.
|
|
|
|
|
Check the URL
[^]">
Cheers!!
Brij
|
|
|
|
|
|
skvs wrote: I'm trying to draw a sine wave on a panel using GDI+, but everytime when i Re-Size it has to redraw the waveform.
You've already asked this question dozens of times and been told that that is how it works. When the form is resized or covered up you are responsible for redrawing it at the size you want. There is no magic gdi+ routine that redraws or zooms in for you.
skvs wrote: Can anyone knows about "Chart control" in C# using GDI+ and if any documentation link is there please give it.
I've already given you the link to the chart control docs and samples.
Simon
|
|
|
|
|
skvs wrote: Can anyone knows about "Chart control" in C# using GDI+ and if any documentation link is there please give it.
Google know lot's of them.
|
|
|
|
|
Help[^]
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hello everyone,
I want to embed a resource file (xml file) into a DLL assembly and access the xml file from the DLL.
But I can not find sample code for me to do this. All samples I could find is dealing with embed and access image in resource file. Could anyone show me a sample please?
thanks in advance,
George
|
|
|
|