Click here to Skip to main content
15,917,709 members

Comments by Burak Demirsoy (Top 4 by date)

Burak Demirsoy 12-Jul-14 16:21pm View    
I tried and nothing changed actually. But I found a way to operate this. So I looked at ns times for receiving and sending times and by observing, I'm now able to open close valve and receive data. However, this seems stupid cus I flush open close function several times as well as for receiving. Theory does not comply with life indeed :) Thanks for help.
Burak Demirsoy 12-Jul-14 6:35am View    
So the open valve function is the following ;

private void OpenValve(string DeviceNo,bool ValvePosition)
{

string giden = "";
SendData[0] = 0xfa;
SendData[1] = Conversions.ToByte(Strings.Mid(DeviceNo, 1, 2));
SendData[2] = Conversions.ToByte(Strings.Mid(DeviceNo, 3, 2));
SendData[3] = Conversions.ToByte(Strings.Mid(DeviceNo, 5, 2));
SendData[4] = Conversions.ToByte(Strings.Mid(DeviceNo, 7, 2));
if (ValvePosition)
SendData[5] = 50;
else
{
SendData[5] = 51;
}
SendData[6] = CheckSum_Temass(5);
SendData[7] = 0xfb;



sp.Write(SendData, 0, SendData.Length);

I manage open/close valve but it takes time. I'm continuously calling OpenValve() function. It should be like when I call OpenValve() function, it should operate at first time. But it does not and cant figure out why ?
Burak Demirsoy 12-Jul-14 6:31am View    
You are totally right. Before you told me I did that way and right now I solved receiving data. However there still exists problems.


I solved the problem which was relasted to parity. In default it is none but in my system it was supposed to be even. So I can receive data right now but the problem is now speed of data.

In Vb. I'm using valveopen function forthtimes to open valve.Therefore I code like ;

valveopen();
valveopen();
valveopen();
valveopen();

However in C# it is like god knows how many times it will operate :). Arbitrarily I'm able to open valve right now. All stuff are the same and no problem. I think data transfer speed of MSComn and Serial Port are different.
Burak Demirsoy 12-Jul-14 1:52am View    
As you can see from Strings.Mid which Mic.VisualBasic.CompilerServices class's function.Therefore, It does not start with 0 in C#. DriverNo = "20021267" all are defined in code.

I compared sent data with C# and Vb.Net, both show the same output in text file (I wrote in a text the output). So from this point, what I've understood is the problem should be related with the output function [sp.Output(VB.Net MSComm) sp.Write(C# Serial Com))