Hi Plater
I succeded to solve my problem. I found a very good article abou serial port in .NET and I want to share it http://www.innovatic.d k/knowledg/SerialCOM/SerialCOM.htm
My last problem was related to the 11 bit communication and with parity
changing. I found the explanation reading this article:
"Microsoft has put an 8 bit wide buffer on top of the 11-bit receiver FIFO and therefore destroyed the possibility...
User Profile
Collapse
-
Hi Plater ,
Thanks for replying,
Regarding the BytesToWrite I felt the need for some way to know precise when write operation finishes and I explain you why.
For example I have a button function and inside I have to write to my controller a sequence of commands. I noticed that I have to press the button on GUI many times until the controller executes. I made further experiments and I discovered that all this stuff is...Leave a comment:
-
Hello,
Recently when trying to rewrite my C# application I hit myself into the following issue:
I was trying to use BytesToWrite property to be sure that all bytes have been written before giving a new command. But strange BytesToWrite seems always to return 0. Why is happening so?. It should be working according to Microsoft online documents or I miss something
Thanks for reply.Leave a comment:
-
Thanks for replying quick as usual.
For the baud rate I’m sure on it, it’s 9600baud. The phenomena happens only when I play with parity. My controler is understanding the address (I see clear on the scope only one reply then waits for command). All signals are good and I can see with the scope the command and data after going correctly.
The only moment when I’m in Mark parity is when I send the address. Parity is changing to Space...Leave a comment:
-
Hello,
Thank you for the code snippet.
I work with bytes in my telegrams and I need finally byte array of received data
I tried with port.ReadExisti ng(); but I don’t have a hex string instead I have data converted in chars and I don’t need this.
Until now I was able to implement this code:
...Code://event data receive. private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
Leave a comment:
-
Hello,
Please can you provide me a code snippet? I tried to implement the solution, and I don’t succeeded. Probably I’m still doing something wrong. I have to create a function witch contains the while loop or a new thread like:
Thread MyThread = new Thread(new ThreadStart
(DoSomethingFun ction));
MyThread.Start( )
Inside DoSomethingFuct ion() do codding?
The while (true) must be always on true?...Leave a comment:
-
Thank you for answer and for idea,
I will try your solution and let you know about results.
Because I was doing a lot of operation in data receive event I began to lose data And the only solution was to set ReceivedBytesTh reshold to a known value. (usually I know how many bytes to expect) Then I was able to read all data in received event function like: port.Read (byte_array,0, BytesToRead); until BytesToRead>0
But the complication...Leave a comment:
-
Hello,
I succeded finally to have an USB to RS485 converter,
I test directly serial comm on RS485 with serial port class in C#
I need to send an address eg ( 0x03 hex ) in 8 bit format to my controller.
In order to tell the controller that is an address I have to set the 9 bit (parity to Mark)
Then I receive the answer from controller (reply with his address 1 byte in hex if is the correct one )
...Leave a comment:
-
Sadly for me I have to focus on USB port, newer computers and especially laptops don’t have any more serial ports. I don’t have any information on this matter concerning other cip manufacturers(o thers than FTDI). I only tested 2 models of USB to RS232 converters having inside FTDI cips. Situation is frustrating because the ‘Bitbus‘ protocol is pretty slow at 9600baud. Even so because of the delay I miss the controller answer that is comming...Leave a comment:
-
Last info: I tried with the serial port build in my docking station(COM1) and seems to be working
No delay and response from RS485 controller. Cold the problem be generated by the FTDI chip(inside my USB to RS232 converter??). My interest is to have communication possibility with newer computers only from USB. And also another point: If I buy a converter fromUSB
direct to RS485 how can I load the dll from the converter manufacturer...Leave a comment:
-
It’s a good idea and I try it but when I set handshaking on RTSpin and run the
program something really bad happens into win XP. I see the blue screen and computer is restarting!!??? ?...Leave a comment:
-
Yes that’s the idea, Here the RTS pin is not used actually for handshaking on RS232 is used for controlling data flow in the RS232_RS485 converter.(this is common for many converters). My connection with the controller on RS485 is half duplex. So when RTS goes to 0 logic (positive voltage) then the converter go to transmit mode. When RTS goes to 1 logic (negative voltage) converter goes in receive mode.
So in the moment I change the RTS...Leave a comment:
-
Hello,
first thank you for answering,
I don't need any delay between the RTS pin set moment and
write data to port. The time interval between RTSenable=true and RTSenable=false
in my C# app is 20mS and in the original dos(driver) is 1.5mS. In this interval
I have to send the command.How can I mannage this in C#??
All the best...Leave a comment:
-
serial_port_RTS_pin_problem in C#
Hello,
I try to do a simple application in Winforms C# to read or write some data on serial port under win XP.I try to communicate with an industrial controller on RS485.So I have an converter RS232- RS485 The signal who does the converter control is RTS (switch RX or TX for RS485 half duplex)
My communication protocol is a version of old BitBus by Intel. When I want to sent something(eg. Address, command) I have to set the...
No activity results to display
Show More
Leave a comment: