1C:Enterprise with PLC Machines

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Interested
Rating: 27
Joined: Apr 5, 2012
Company: 1TÇ Şirketi - Merv Bilgi İşlem Otomasyonu Yazılım Ltd. Şti.

Hi

We have the PLC machine that work in same network with PC in whitch 1C:Enterprise platform is working.

The machine send and accepts data in ASCII format and Binary format.

We want to control that Machine from 1C:Enterprise application.

Somehow we can control with WinSock library of Windows, but there is some difficulties in working with ASCII format.

Anyone had experience working with ASCII formatted data? Any ideas?

 
#2
People who like this:0Yes/0No
Interested
Rating: 27
Joined: Apr 5, 2012
Company: 1TÇ Şirketi - Merv Bilgi İşlem Otomasyonu Yazılım Ltd. Şti.

I think:

Platform is using UNICODE and when reading within the Winsock library, for data received from machine (PLC uses ASCII sym.), Platform performs own data in UNICODE, so that even if symbols in ASCII and UNICODE are same - data is true. But even if not same in both codes - data is reconverted into something can not be understood.

When I use the event and method of ActiveX WinSock Control for example:

Code
Procedure WinSockControlDataArrival(Control, bytesTotal)

Data = Undefined;

Controls.WinSockControl.Getdata(Data); //The command of WinSock control that receives the data when
//the machine is sends it

//after getting the data, type of "Data" variable becomes Type("COMSafeArray") which is already
//returned in UNICODE coding system

EndProcedure

 
#3
People who like this:0Yes/0No
Interested
Rating: 27
Joined: Apr 5, 2012
Company: 1TÇ Şirketi - Merv Bilgi İşlem Otomasyonu Yazılım Ltd. Şti.

Victory!!!

I solved how to work with it. 1C:Enterprise "COMSafeArray" with types is just perfect thing.


but there is last problem. When machine sends me "90000" type number - when I receive it with COMSafeArray - in array 4 steps. 1 Step - 144. 2 Step - 95. 3 Step - 1. 4 Step - 0.

 
#4
People who like this:0Yes/0No
Interested
Rating: 27
Joined: Apr 5, 2012
Company: 1TÇ Şirketi - Merv Bilgi İşlem Otomasyonu Yazılım Ltd. Şti.

I need the gold relationship that converts Platform from ASCII code to UNICODE.

Anyone who can help in it?

 
#5
People who like this:0Yes/0No
Interested
Rating: 27
Joined: Apr 5, 2012
Company: 1TÇ Şirketi - Merv Bilgi İşlem Otomasyonu Yazılım Ltd. Şti.

for example in visual basic it will be

Code
UInt32 b32 = BitConverter.ToUInt32(COMSafeArray, 0);


it is automatically converts the codes in array to UNICODE code.

 
#6
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Sep 16, 2011
Company: individual

Hi, Murat!
Congratulations to your success.
ASCII and UTF-8 for basic latin characters are the same, except BOM at the beginning of the file, if used. For other characters see Unicode code charts.

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.