RSS  e-mail  sitemap

Internet Remote Laboratory

logo gymkt

Physical Internet-controlled experiments

Grammar-school of J. Vrchlicky, Klatovy

úvod experimenty o laboratoři kontakt odkazy

K8055-M.A.R.I.E.

(Management Application for Remote Internet Experiments)

Commands and management (WILL BE UPDATED: from version 2.5 used a completely new way)

Communication between the controller and the application website K8055-MARIE is implemented using the JavaScript XMLHttpRequest module and the procedure itself uses the AJAX methods. This is the combined use of JavaScript module, which is implemented in modern web browsers, the client-side and supporting PHP scripts running on the server side. With this way of proceeding is not necessary to install any client side extensions as necessary environment for running Java applets, or elements of different extensions ActiveX.

Remote management is implemented classic web page written in HTML language, extended with JavaScript commands to communicate with the K8055 board (see Fig. 1). These commands are stored in an external file K8055.js, which is given to the website connects just like any other javascript file. AJAX method is mediated by the standard JavaScript library jQuery for reasons of compatibility for different types and versions of Internet browsers. It adds security and reliability of communication.


schéma komunikace strany klienta a serveru při instalaci na dvou rozdílných PC

Figure 1 - Diagram of communication by the client and server


Expansion JavaScript commands for K8055

Library of commands K8055.js

We attach the JavaScript library of the control-commands to a Web page by using files jQuery.js and K8055.js in the section <head>...</head>. These files are stored in folder jvs in the sample demo file.

The code of the sample file K8055-MARIE_demo.htm, looks like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=Windows-1250">
<title>K8055-MARIE : Demo</title>
<!-- BEGIN - JavaScripts for Remote Control -->
<script src="jvs/jquery-1.12.4.min.js" type="text/javascript"></script>
<script language="Javascript" type="text/javascript" src="http://YOUR_IP:PORT/K8055.js"></script>

<!-- END - JavaScripts for Remote Control -->
:
:

The file jquery-1.12.4.min.js (or another version) is a jQuery library that extends the HTML page for general instructions AJAX-Communications. File K8055.js expands the web page on commands for a remote control of the K8055 board. This script file is not part of web-pages, but it is read from application K8055-MARIE. The control commands can be called by a standard JavaScript event (eg. page loads, click on the element, timer expires…etc.). Creation of a control website is the full responsibility of its creator.


Example
Sample of a web element (button) which when clicked sets all digital outputs on the K8055 board logic value 1:

<input type="BUTTON" value="Turn on outputs" onClick="SetAllDigital();">


Commands from library K8055.js

Commands are trying (by their syntax) correspond with the original commands used in the DLL commands firm Velleman. New commands have been added for the purpose of enhanced and faster remote control from version 2.00. Command Reference of the library K8055.js is given in the table below.

K8055D.DLL v5.0.0.0 - K8055D.DLL v5.0.0.0 - Technical Manual - Czech translation

Description of the functions and procedures contained in the DLL library K8055D.DLL for direct control of USB board K8055 (Czech translation, the original English text on the website of Velleman).


The following table shows a list of commands javascript library K8055.js, including their descriptions:

K8055-MARIE (ver. 1.xx → x.xx)
Command Description of the command
ReadAnalogChannel(Channel)

The function returns an integer (0-255) corresponding to the voltage on the analog input. Variable Channel indicates whether the input 1 or 2

Example: (read analog input 1 to the variable AD1)

var AD1 = ReadAnalogChannel(1);

ReadAllAnalog()

This function returns a character string composed of a pair of numbers corresponding to the voltage on the analog inputs. Both values are separated by |.

Example: (convert the output string to numeric variables hod1 and hod2)

var vyst = ReadAllAnalog();
var hod = new Array(2);
hod = vyst.split('|');
var hod1 = parseInt(hod[0]);
var hod2 = parseInt(hod[1]);

OutputAnalogChannel(Channel, Data)

Analog output - variable Channel determines whether the output 1 or 2 A numeric variable Data (0-255) determines the value of the output voltage (or width modulated signal)

The function returns true in the successful output settings (or false for failure).

SetAnalogChannel(Channel)

Sets the analog output (variable Channel) to the maximum value 255

The function returns true in the successful output settings (or false for failure).

Note:
same as the OutputAnalogChannel(Channel, 255)

ClearAnalogChannel(Channel)

Sets the analog output (variable Channel) to the minimum value 0

The function returns true in the successful output settings (or false for failure).

Note:
same as the OutputAnalogChannel(Channel, 0)

OutputAllAnalog(Data1, Data2)

Sets both analog outputs to the specified variable values Data1 and Data2.

The function returns true in the successful outputs settings (or false for failure).

SetAllAnalog()

Sets both analog outputs to the maximum value 255

The function returns true in the successful outputs settings (or false for failure).

Note:
same as the OutputAllAnalog(255, 255)

ClearAllAnalog()

Sets both analog outputs to the minimum value 0

The function returns true in the successful outputs settings (or false for failure).

Note:
same as the OutputAllAnalog(0, 0)

SetDigitalChannel(Channel)

Sets a specified bit (variable Channel) from the set of eight digital output lines to logic 1 (ie the output terminal status ON).

The function returns true in the successful output settings (or false for failure).

ClearDigitalChannel(Channel)

Sets a specified bit (variable Channel) from the set of eight digital output lines to logical 0 (ie the output terminal status OFF).

The function returns true in the successful output settings (or false for failure).

WriteAllDigital(Data)

Sets the bits set of eight digital output lines corresponding to the values of binary numbers specified variable Data.

The function returns true in the successful outputs settings (or false for failure).

SetAllDigital()

Sets all digital output lines to logic 1 (ie the output terminal status ON).

The function returns true in the successful outputs settings (or false for failure).

Note:
same as the WriteAllDigital(255)

ClearAllDigital()

Sets all digital output lines to logical 0 (ie the output terminal status OFF).

The function returns true in the successful outputs settings (or false for failure).

Note:
same as the WriteAllDigital(0)

ReadDigitalChannel(Channel)

Returns the value true (or false) if at the time of query pressed one of five (defined variable Channel) digital inputs.

ReadAllDigital()

Returns the integer value of compiling pressed digital inputs. (First Input: 1, second: 2, third: 4, fourth: 8, fifth: 16)

Example: (status unmasking of digital inputs)

var pom = ReadAllDigital();
if ((pom & 1) != 0) {1st input IS pressed}
   else {1st input is NOT pressed};
if ((pom & 2) != 0) {2nd input IS pressed}
   else {2nd input is NOT pressed};
if ((pom & 4) != 0) {3rd input IS pressed}
   else {3rd input is NOT pressed};
if ((pom & 8) != 0) {4th input IS pressed}
   else {4th input is NOT pressed};
if ((pom & 16) != 0) {5th input IS pressed}
   else {5th input is NOT pressed};

ReadCounter(CounterNr)

Returns the value of one of the two inputs (digital inputs 1 and 2). Counter number is determined by the variable CounterNr

Counter registers since it was reset and responds only to the desired pulse length (see below)

ResetCounter(CounterNr)

Resetting the counter 1 or 2 (determined by variable CounterNr)

Function returns true in successfully reset the counter (or false for failure).

SetCounterDebounceTime(CounterNr, TimeDebounceTime)

Setting the minimum pulse length in milliseconds (an integer variable TimeDebounceTime), which will be registered with the specified counter 1 or 2 (variable CounterNr).

Function returns true in the successful counter settings (or false for failure).

K8055-MARIE (ver. 2.00 → x.xx)
SearchDevices()

It returns a string composed of addresses (0-3) of the USB K8055 boards connected to PC and allowed by application K8055-MARIE (Addresses of the boards are separated by symbol: | ).

SetCurrentDevice(CardAddr)

It sets the board of the specified address CardAddr (0-3) as the recipient of next commands.

Function returns true in the successful board settings (or false for failure).

ReadBackDigitalOUT()

It returns a read back the value (0-255) of digital outputs, which is currently set to USB output boards (USB board is specified by command SetCurrentDevice()).

ReadBackAnalogOUT()

It returns a string composed of a pair of back-read values (0-255) of analog outputs of the USB board (Output values are separated by symbol: | ).

ReadBothCounters()

It returns a string composed of a pair of back-read values (0-255) of counters of the USB board (Counters values are separated by symbol: | ).

Note:
It is a command that replaces a pair of commands
ReadCounter(1);
ReadCounter(2);

ReadAllInputs()

It returns a string composed of a pair of back-read values (0-255) of analog outputs, value representing pressed digital inputs (see ReadAllDigital()) and a pair of back-read values (0-255) of counters of the USB board (All values are separated by symbol: | ).

Note:
It is a command that replaces a series of commands
ReadAllAnalog;
ReadAllDigital();
ReadBothCounters();

ReadStatus()

It returns a string composed of the values of a complete state of USB boards (ie: analog inputs, digital inputs, counters, values of the analog outputs and digital outputs). All values are separated by symbol: |.

Note:
It is a command that replaces a series of commands
ReadAllInputs();
ReadBackAnalogOUT();
ReadBackDigitalOUT();

GeneratorType(Channel,Type) wave form

It sets the type (Type) of waveform (1 - sinus, 2 - square, 3 - ramp, 4 - sawtooth, 5 - triangle) that will generate (range 0-255) on the analog output Channel (1-2).

Function returns true in the successful board settings (or false for failure).

GeneratorFrequency(Channel,Freq)

It sets the frequency Freq (0,01-10 Hz) of the waveform that will be generated on the analog output Channel (1-2).

Function returns true in the successful board settings (or false for failure).

GeneratorTimeInterval(Channel,Time)

It sets time Time (1-300 s) of the duration of the waveform generated on analog output Channel (1-2).

Function returns true in the successful board settings (or false for failure).

GeneratorStart(Channel)

It starts waveform generating (parameters described earlier) on the analog output Channel (1-2).

Function returns true in the successful board settings (or false for failure).

GeneratorStop(Channel)

It stops waveform generating on the analog output Channel (1-2). (independently of any preset Time – see GeneratorTimeInterval())

Function returns true in the successful board settings (or false for failure).

K8055-MARIE (ver. 2.55 → x.xx)
K8055_Json(cardAdr)

will be described

Analog OUTs:
card[0].OUT.ANALOG.A
card[0].OUT.ANALOG.B
Digital OUT:
card[0].OUT.DIGITAL
Analog INs:
card[0].IN.ANALOG.A
card[0].IN.ANALOG.B
Digital IN:
card[0].IN.DIGITAL.A
Counters:
card[0].IN.COUNTER.A
card[0].IN.COUNTER.B
K8055-MARIE (ver. 2.56 → x.xx)
SwissKnife(cardAdr, com, callback)

will be described

Only a proficient developers!


Instalace Dema Back  |  Next Instalace Dema

Google TranslateThis Page is translated by  Google Translate. nahoru
Free counters!
© 2011-17 by N.P.C.