KOAN Software embedded winCE

Contattaci ITA ENG

 

 

KOAN SOFTWARE ®

 
Home » Supporto »

 

ControlWeb FAQ

12.February.2004 Marco Cavallini - m.cavallini[at]koansoftware[dot]com [Letto 6669 volte]

Q. If during the CW code editing (in Text editor) I do some mistakes, is impossible to switch to Graphic editor, is it possible to bypass this behavior ?
A. It is impossible. Source text must be good, because graphic view of application is builded from source text every time.

Q. If I put comments into the code using (* comment *) I loose all the comments after rebuild/run How can I obtain comments persistence ?
A. The comments can't be outside of script. Every instruments has "rem" parameter for your comments too. Control Web does not save source text - source text is always generated from current graphic view of application.

Q. I need to send a digital output to a controller using OPC client, this controller makes a motor step forward each time I write out 1 to the channel, and makes a motor step backward each time I write out 0 to the channel. For example I need to send 1 many time (supposing 20 times) but seems that CW inhibits me to write the same value more than once if the value itself is the same as the one I want to send. So the second time I try to write out the value 1 there is no motor movement.
A. In the instrument you must set parameter "send_same_data" to on.

Q. How to show bitmap (BMP, GIF, etc...) files into CW pages ?
A. It is very easy. Every panel can contains any DataView (image is also DataView). If you want to show any bitmaps, you must fill panel's parameter "dv_file" with appropriate image file.

Q. Which graphic formats are supported ?
A. Image DataView supported all commons image file formats. Please open "Image Viewer" appliacation from start menu and select "File" menu and "Open" command - in file box you can see list of all supported bitmaps file formats.

Q. And how to start the program without writing the outputs ? I need to write them only if I modify the control.
A. You must set parameter ‘skip_init_outputs = true’ in the settings section

Q. How could I set an output value using a 'control' instrument ? Do I need to park the value in a variable or can I write it directly to the PLC ?
A. You can write directly to PLC (by using driver's channel) , certainly.

Q. I wonder why using a meter instrument I can't show a value greater than 100, I tried modifying range_to property without success.
A. You have to set properly the ‘range_to’ property in the object end of scale range.

Q. I don't know how to obtain a human readable file name when storing data to an archive
I get something like Myname9PS4W.DBF although I select long filenames = TRUE.
A.


Q. How to set a variable value reding some channels without drawing any object on the screen ? For example if chan1 > chan2 then set var1 = chan3 * 10
A. It's very easy. You must assing the channel to variable.Sample:

program MyProg;
procedure OnActivate();
begin
if chan1 > chan2 then
var1 = chan3 * 10;
end;
end_procedure;
end_program;


Q. I'd like to call a generic function (I program in C not in pascal) from various procedures into the same program ? For example I need to call MyFunction( a : integer ) and return a value to the caller.
A. This is the sample code:

program MyProg;

procedure MyProc1( a, b, result : real );
begin
result = a * b;
end_procedure;

procedure MyProc2();
var
r = real, 0;
begin
self.MyProc1( 10, 20, &r );
meter.SetValue( r ); (* value in r can be show in meter instrument *)
end_procedure;

end_program;

Q. How can I execute a procedure hourly or at a determined hour without drawing objects (in background)
A. You must use a program instrument and define appropriate timer.

program MyProg1;
timer = 3600; (* 1 hour = 3600 second *)

procedure OnActivate();
begin
(* this instrument's procedure will be activated every 1 hour *)
(* some your code *)
end_procedure;

end_program;

program MyProg2;
timer = 86400, 36000;
procedure OnActivate();
begin
(* this instrument's procedure will be activated every 10 a.m. every day *)
(* 86400 = number seconds in day; 36000 is offset in seconds from start of day 60sec * 60min * 10hour *)
(* some your code *)
end_procedure;

end_program;
Q. How can I know when all channels are read at least once and their values are reliable ?
A. Please see the documentation, Chapter 15, part Attributes

Q. If I use a File DSN + ODBC to access a MDB database, how can I access to a particular table into the database ?
For example Database=ALP.MDB TABLE=Macchina1
A. You must use a SQL SELECT statement to access to table data.

procedure OnMouseUp( MouseX, MouseY : integer; LeftButton, MiddleButton, RightButton : boolean );
var
Path = string, '';
Head = string, '';
Tail = string, '';
err = real, 0;
ok = boolean, false;
begin
(* ------------------------------------------------------------------------------ *)
SQL.OpenDatabase( 'C:ControlWebAlp.DSN', '', '', &ok );
if ok then
(* This SQL statement selects all records from table MACCHINA1 *)
SQL.OpenRecordset( 'Macchina1', 'SELECT * FROM MACCHINA1' &ok );
if ok then
SQL.MoveToFirstRecord( 'Macchina1', &ok );
while ok do
SQL.ReadData( 'Macchina1', ColumnNumber, &ColumnData, &ok );
(* or *)
SQL.ReadData( 'Macchina1', ColumnName, &ColumnData, &ok );
SQL.MoveToNextRecord( 'Macchina1', &ok );
end;
SQL.CloseRecordset( 'Macchina1' );
end;
end;
(*------------------------------------------------------------------------------ *)
end_procedure;

Q. How can I open Instrument Inspector directly clicking on the object ?
A. You can open Instrument Inspector with Right click by setting in menu Tools-Preferences select SystemOptions tab and
unselect Right mouse button above visual editor opens object menu
unselect Right mouse button above instrument trees opens object menu
select Load selected instrument data into opened inspector

Q. What syntax have I to use for SQL statements ?
A. For SQL syntax description see http://www.sql.org/

Q. What is OCL ?
A. OCL ‘Open Control Language’ is the Pascal like language used by ControlWeb

Q. Which are the SQL procedures implemented into CW ?
A. All OCL procedures are listed in the Instrument Inspector object help, or into the manual


 
©Copyright 1996-2010 KOAN SAS - PIVA:IT02460270164