Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > 1C:Enterprise with PLC Machines

Forum

Search UsersRules
1C:Enterprise with PLC Machines
#1
Interested
Points:: 0
Joined:: Apr 5, 2012

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?

Profile
#2
Interested
Points:: 0
Joined:: Apr 5, 2012

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

Profile
#3
Interested
Points:: 0
Joined:: Apr 5, 2012

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.

Profile
#4
Interested
Points:: 0
Joined:: Apr 5, 2012

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

Anyone who can help in it?

Profile
#5
Interested
Points:: 0
Joined:: Apr 5, 2012

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.

Profile
#6
Active user
Points:: 32
Joined:: Sep 16, 2011

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.

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.