Scrigroup - Documente si articole

     

HomeDocumenteUploadResurseAlte limbi doc
BulgaraCeha slovacaCroataEnglezaEstonaFinlandezaFranceza
GermanaItalianaLetonaLituanianaMaghiaraOlandezaPoloneza
SarbaSlovenaSpaniolaSuedezaTurcaUcraineana

AdministrationAnimalsArtBiologyBooksBotanicsBusinessCars
ChemistryComputersComunicationsConstructionEcologyEconomyEducationElectronics
EngineeringEntertainmentFinancialFishingGamesGeographyGrammarHealth
HistoryHuman-resourcesLegislationLiteratureManagementsManualsMarketingMathematic
MedicinesMovieMusicNutritionPersonalitiesPhysicPoliticalPsychology
RecipesSociologySoftwareSportsTechnicalTourismVarious

Ethernet & RS232 Interface Guide

comunications



+ Font mai mare | - Font mai mic



Ethernet & RS232

Interface Guide



OASys ActiveX Control,

Hardware Configuration,

And Interface

Select Electronics Corporation reserves the right to update, or modify this document without notice. The information within this document is believed to be accurate and correct. Select Electronics shall not be held liable for errors contained within this document, the incidental or consequential damage or losses resulting from or in connection with the interpretation, presentation, or product performance relating to the use or availability of material within, or to the product itself.

The proprietary information contained within this document is copyright protected. No part of this document may be reproduced, photocopied, or distributed without the expressed written consent of Select Electronics Corporation.

Table of Contents


Brief overview of OASys Ethernet interface

Installing Ethernet card into OASys controller

Configuring IP Addresses

Coordinate system

OASysX Control KDS APIs

Clear Video

DequeueAck +++

DequeueBumpBar   +++

DisableClock

DisableCriticalMessages   +++

DisableCursor

DisableDiagnostics   +++

DisableVideoOutput

DisplayClock

DisplayText

DrawBox

EnableCriticalMessages   +++

EnableCursor

EnableDiagnostics +++

EnableVideoOutput

HardReset

LowLevelCommand

MapVideo

MoveBlock

ResetAutowrap

ResetTextWindow

RestoreEntireScreen

RestorePartialScreen

SaveEntireScreen

SavePartialScreen

SelectVideo

SetAck +++

SetAutowrap

SetBorderColor

SetCursorPosition

SetOutputMode

SetScreenSaver

SetTextWindow

SetVideoMode

SoftReset

SetTextAttribute

SendBlockedMsgs

Shutdown +++

SoundBumpBar

+++ denotes a new or modified function

Table of Contents (cont.)


OASysX Control Virtual Comm Port APIs

BufferCommByte

BufferCommString

ClosePort

DefineVirtualPort

DequeueCommMsg 

FlushCommBuffer

GetCommData

GetSpaceInRXBuffer

GetSpaceInTXBuffer 

MapVirtualPort

SendCommBuffer  

SetCommAck

Brief overview of OASys Ethernet interface

The OASys controller is capable of running a standard TCP/IP Ethernet interface. Software can be written to talk directly to the OASys controllers IP address using a UDP protocol or using the OASys ActiveX Control to do the same. Using the Ethernet option allows a virtually unlimited number of OASys controllers,video screens and virtual printers to be accessed over a high-speed network.

Installing Ethernet card into OASys controller

The Ethernet card can be physically plugged into any one of the available slots in the OASys box, just as any other card. Once this card is installed, the cover is replaced and the unit is powered up there is still a small amount of work to be done to properly configure the Ethernet card and IP address. Typically, the OASys controller will be shipped with a generic program flashed onto it such as EVBASIC (see Users Guide for more details on flash programs) which supports a more standard RS232 interface. In order to configure the controller properly several steps need to be performed.

Flash each OASys unit with the SETUP.EXE program found on the Ethernet Card Utility Diskette.

Run SETUP.EXE on the OASys box from a DOS prompt and configure the Ethernet card for IRQ 10, BASE I/O ADDRESS 0x300. A DOS prompt can be obtained by installing a PC keyboard and depressing the ESC key once the system has loaded. Dont forget to save the settings permanently.

Flash each OASys unit with an SEC program that supports Ethernet such as ETHBASIC.

Flash the OASys unit with a valid packet driver.

Reprogram or flash the OASys unit with a new AUTOEXEC.BAT file that will load the packet driver correctly.

Reprogram the EVBASIC.INI file on each OASys unit to declare Ethernet network option and IP Address.

***NOTE: A batch can be created to perform most of these steps in one simple procedure. If help is required in configuring your OASys box or creating a batch that will do the same, contact SEC.

Configuring IP Addresses

The IP address of the host computer is selectable via the Network settings found in the Control Panel. The OASys box, when first powered up, knows its own IP address but has no knowledge of the IP address of the remote PC. It will listen for incoming messages and strip off the IP address of the remote computer and use it for sending data to, including all bump bar keystrokes. The IP address of the OASys box is programmable via the EVBASIC.INI file.

EXA: IP ADDRESS = 101.1.1.1

If not entered in the .INI file, the IP address will default to 101.1.1.1. Whatever IP address is programmed at the OASys will be displayed on the boot up screen as well as on the diagnostics screen.

In order to utilize several OASys boxes, each OASys box must have its own unique IP address. The MapVideo function in the OASysX must then be used to assign an IP address and Card ID to any of the logical videos (1-16) referenced in the SelectVideo function.

Coordinate system

Keep in mind that the OASys controller, when running in a text mode, has 80 columns and 25 rows. The coordinates are designated as 1-80 for columns and 1-25 for rows. All of the APIs that reference rows, columns or screen coordinates are based on these number ranges. Anything outside these ranges of coordinates will produce error messages (if enabled) or unexpected results.

OASysX Control KDS APIs

The OASysX calls are very similar to the calls provided in our 16 bit and 32bit libraries. There have been a few additions and minor modifications in order to enhance the capabilities and ease of use. This ActiveX control is actually an ActiveX EXE which has a KDS class module. This control currently supports a Winsock interface for Ethernet functionality and RS232 style communications selectively.

All functions return an Integer value, which will indicate a successful completion or error, unless otherwise specified. A successful completion will return a zero and an unsuccessful completion will return a non-zero (negative).

The control has a form of its own which it is capable of displaying. This is used for diagnostics purposes and currently is very basic in nature.

Some of the functions have been ported to the control but have no use or meaning in the OASys box. These were intended to provide backward compatibility since this control will support our older hardware as well.

One unique feature about the OASys controllers and the software provided by SEC is that we are not limited to the command set or functionality that is provided here. If there are any additional functions or modifications to existing functions that are required, please contact SEC and we will gladly accommodate any requests.

Function ClearVideo(ByVal ForeColor As Integer, ByVal BackColor As Integer) As Integer) As Integer

ForeColor Foreground color (0-15)

BackColor Background color (0-7), high order bit turns on blinking

This function will clear the entire screen to a particular color as set by the background color parameter. It will also set the default foreground and background color for further screen updates. If a text window is defined while this command is issued, only the area within that text window will be cleared.

Function DequeueAck(ByVal Video As Integer) As Integer

Video (1-16)

This function can be called on periodically to return any status that have been returned by the OASys controllers. These may simply be acknowledgements returned as requested or may be messages returned from the OASys as a result of an error.

Function DequeueBumpBar(ByVal BumpBarID As Integer) As Integer

Bump bar (1-16)

This function needs to be called frequently to check on the status of bump bar keystrokes. If there are any keystrokes in the queue they will be immediately returned. Otherwise, a (-1) will be returned indicating there are no keys in the queue.

SK9200 Key return codes

1 = 0x30, 2 = 0x31, 3 = 0x32, 4 = 0x33, 5 = 0x34, 6 = 0x35, 7 = 0x36, 8 = 0x37, 9 / Right Arrow = 0x3E

Clear = 0x3F, Park = 0x39, Summary = 0x3A, Recall = 0x3B, Esc=0x38, Refresh=0x3D,0 / Left Arrow = 0x3C

Function DisableClock(ByVal ClockID As Integer) As Integer

Clock ID (1-20).

This function can be called to disable a logical clock that has been previously initiated. There is no harm done in disabling a clock that is not enabled. Disabling a clock does not necessarily remove it from the screen. It must be overwritten at some point to physically remove it.

Function DisableCriticalMessages() As Integer

Disables POP UP messages from displaying on critical errors. These errors include parameter errors caused by calling functions. It may be a good idea to have this on in the debugging stages but not in the release stages. This POP UP will stop the control dead in its tracks until the user acknowledges it. (default)

Function DisableCursor() As Integer

This function will permanently disable the cursor from displaying on the screen.

Function DisableDiagnostics() As Integer

Disables the diagnostics form from displaying. (default)

Function DisableVideoOutput() As Integer

This function will disable all video output to this screen until it becomes enabled again.

Function DisplayClock(ByVal ClockID As Integer, ByVal Min As Integer, ByVal Sec As Integer, ByVal Row As Integer, ByVal Col As Integer) As Integer

ClockID (1-20)

This function allows the user to define up to 20 logical clocks to display on the screen at any given time. These clocks are currently in the form of mm:ss. Once a clock defined it will start ticking once a second until it is disabled. If overwritten on the display by some other text command the clock will refresh itself each second, thereby overwriting any text that had been displayed.

Function DisplayText(ByVal text As String) As Integer

This function will display text at the current cursor position using the currently selected text attributes.

Function DrawBox(ByVal BoxType As Integer) As Integer

Box type (0-2)

Draws a box on the display bordering the currently selected text window. Type 0 = solid, type 1 = single line border and type 2 = double line border.

Function EnableCriticalMessages() As Integer

This function enables a Critical Message POP UP box. This POP UP box will stop the control in its tracks until the user acknowledges it and is only suggested for diagnostics purposes. It is very helpful in the beginning stages of the project to help insure proper operation and programming.

Function EnableCursor() As Integer

This function enables or re-enables the display of the cursor on the screen.

Function EnableDiagnostics() As Integer

This function enables the display of a diagnostics form by the OASysX Control.

Function EnableVideoOutput() As Integer

Enables or re-enables video display output. (default)

Function HardReset() As Integer

Performs hard reset of controller. This will reboot the controller to a known state. However, due to the fact that the OASys controller has a built in watchdog timer this should not be necessary at any point unless the watchdog has been disabled.

Function LowLevelCommand(ByVal Cmds As String) As Integer

Allows direct transmission of low level escape sequences to the OASys controller. This is added to provide a means of adding commands to the OASys command set without requiring the ActiveX Control to be in sync on a version by version basis.

Function MapVideo(ByVal Video As Integer, ByVal IP As String, ByVal Card As Integer) As Integer

Video Video ID (1-16)

IP Valid IP address Exa: 101.1.1.1 -or- Comm port COMM1

Card Card ID within OASys box (1-3) -or- SV2000 box (1-16)

This function maps an IP address and Card ID to a logical video. When running with a single OASys controller, the default IP address and default card ID can be used. However, under most circumstances this function is necessary and should be run prior to all other function calls. When running a system with multiple OASys boxes, each box housing multiple video cards and using a different IP address, it is necessary for the control to know where everyone is. Via this function you can tell the control the physical address of all of the videos in the system by mapping it to a logical address (1-16).

If RS232 method of communications is required then the IP parameter should be a valid port along with the desired baud rate. EXA: COMM1,19200 or COMM2,28800 or COMM1 115200.

Function MoveBlock(ByVal ulr As Integer, ByVal ulc As Integer, ByVal lrr As Integer, ByVal lrc As Integer) As Integer

This function moves an area on the screen to another area as defined by the current cursor position.

Function ResetAutowrap() As Integer

This function resets text autowrap mode. This means that if any text displayed on the screen or within a window would cause that text to go off the screen or out of the window, it will be truncated.

Function ResetTextWindow() As Integer

This function resets the currently defined text window to the entire screen.

Function RestoreEntireScreen() As Integer

This function will restore an entire screen image that had been previously saved via a SaveEntireScreen command.

Function RestorePartialScreen(ByVal ulr As Integer, ByVal ulc As Integer) As Integer

This function restores a partial screen image that had been previously saved via the SavePartialScreen command. This partial screen image will have its upper left corner located at the coordinate defined by the passed parameters.

Function SaveEntireScreen() As Integer

Saves the entire visible screen to a temporary screen buffer.

Function SavePartialScreen(ByVal ulr As Integer, ByVal ulc As Integer, ByVal lrr As Integer, ByVal lrc As Integer

Saves a partial screen area, as defined by the passed parameters, to a temporary screen buffer.

Function SelectVideo(ByVal Video As Integer) As Integer

Video Video ID (1-16)

This function is used to select the logical screen that is being addressed. All commands issued from this point on, until another screen is selected, will be performed on this logical screen.

Function SetAck(ByVal AckMode As Integer) As Integer

AckMode - 0 = No Ack

1 = Ack Required

This function will allow an ACK mode to be turned on that will require an acknowledgment to be returned from the OASys controller each time it receives a message. Under this new system this is not required for reliable data transmission but has been added to be 100% backward compatible with our previous products.

Function SetAutowrap() As Integer

This function sets text output to autowrap. This means that if text were displayed that would normally overflow the width of the screen or text window , it will wrap to the beginning of the next line.

Function SetBorderColor(ByVal Color As Integer) As Integer

This function sets the screen border color.

Function SetCursorPosition(ByVal Row As Integer, ByVal Col As Integer) As Integer

This function sets the screens cursor position for any following screen updates. If a text window is defined than the cursor position will be defined within that window.

Function SetOutputMode(ByVal Mode As Integer) As Integer

Mode - 0 = Unblocked

1 = Blocked

This function determines the mode of data tranmission to the OASys controllers. If UNBLOCKED is chosen than each time a function is called that performs a screen update, a message is sent over the network to that controller. This may cause a lot of unnecessary overhead and is not the preferred method. BLOCKED mode will queue a series of commands together before sending them over the network and will release them at the programmers request (via the SendBlockedMessages command), when a new screen is selected (via SelectVideo command) or when the message buffer is full.

Function SetScreenSaver(ByVal Min As Integer) As Integer

This function will set a screen saver timer in minutes. 0 indicates no screen saver. When no bump bar depressions have occurred and no screen updates have occurred for this predetermined period of time the screens will go blank.

Function SetTextWindow(ByVal ulr As Integer, ByVal ulc As Integer, ByVal lrr As Integer, ByVal lrc As Integer) As Integer

This function sets coordinates for a text window. Once a text window is defined, all following screen updates will be performed within this window.

Function SetVideoMode(ByVal Mode As Integer) As Integer

Mode - 0 = 80x25

Sets the screen operation mode.

Function SoftReset() As Integer

Performs soft reset on controller. The OASys controller will parse this command but will not really perform any function. This has been added for 100% backward compatability.

Function SetTextAttribute(ByVal ForeColor As Integer, ByVal BackColor As Integer) As Integer

This function sets the text attribute for all subsequent text output to the display.

Function SendBlockedMsgs() As Integer

This function causes all messages that have been blocked (BLOCKED mode only) to be immediately send on the network to the OASys controller.

Function Shutdown() As Integer

This function will shutdown the control gracefully. This must be performed prior to closing application. Otherwise, unpredictable system operation may result.

Function SoundBumpBar(ByVal Keypad As Integer, ByVal Freq As Integer, ByVal Duration As Integer) As Integer

This function allows the programmer to sound a remote bump bar speaker for any reason. By changing the frequency and duration values various tones can be achieved.

OASysX Control Virtual Comm Port APIs

In Addition to performing normal KDS functions the OASysX control is now capable of supporting remote devices via the comm ports available on the OASys box. The Virtual Comm Ports are supported via a separate set of APIs but can be inter-mixed with the KDS code. Virtually any type of RS232 device can be supported via these available comm ports since the APIs will support bi-directional communications, flow control and variable baud rates.

Please note that all functions addressing a remote port will be addressing the virtual port number (1-16). The MapVirtualPort function must be performed prior to all other functions so that the APIs can resolve the physical addresses of these ports.

Function BufferCommByte(ByVal Data As Integer) As Integer

This function will buffer a single byte for transmission. This data will not be transmitted to the OASys box until the SendCommBuffer is requested. The virtual port is not selected at this time. This function is just for creating the transmit buffer.

Function BufferCommString(ByVal Data As String) As Integer

This function will buffer a string of data for transmission. This data will not be transmitted to the OASys box until the SendCommBuffer is requested. The virtual port is not selected at this time. This function is just for creating the transmit buffer.

Function ClosePort(ByVal Port As Integer) As Integer

This function will close a port if it was previously opened. Please note that it is not necessary to close a port in order to redefine it. The DefineVirtualPort will close an opened port prior to defining it.

Function DefineVirtualPort(ByVal Port As Integer, ByVal BaudRate As Integer, ByVal FlowControl As Integer, Optional TXSize As Integer, Optional RXSize As Integer) As Integer

Port- 1-16

BaudRate - 2400/4800/9600

FlowControl - 0 = None, 1 = RTS/CTS, 2 = DSR/DTR

TXSize - OPTIONAL PARAMETER, Transmit buffer size (Default 1024 bytes)

RXSize - OPTIONAL PARAMETER, Receive buffer size (Default 128 bytes)

This function is used to define the personality of the remote ports. Via this function the baud rate and flow control can be defined. The remote port will be opened with the appropriate parameters. If the port had been previously defined than this function will close the port prior to re-opening it. If TXSize or RXSize is set to zero (0) than the default value will be used.

Function DequeueCommMsg(ByVal Port As Integer) As Integer

Port - 1-16

This function will remove the oldest message from the message queue. Any responses or error messages from the OASys controllers will be logged in this queue. If ACKs are enabled (via SetCommAck function) than all messages sent to the OASys controller will respond with an ACK or NAK type message. Otherwise, messages will be placed in this queue only due to errors.

Valid return codes are: 0 = ACK

Bit 7 set = OASys reset

Bit 2 set = Block sequence error

Function FlushCommBuffer() As Integer

This function will flush/kill/delete any data currently in the comm buffer without putting it on the network.

Function GetCommData(ByVal Port As Integer) As Integer

Port - 1-16

This function will return a data byte, if one is available, that has been returned from the device attached to the virtual port. This is strictly data and should not be confused with the ACK/NAK queue described in the DequeueCommMsg function. Returns (-1) if there is no data available.

Function GetSpaceInRXBuffer(ByVal Port As Integer) As Integer

Port - 1-16

This function will return the number of bytes available in the Receive Buffer of a port. If there is a problem accessing the OASys controller, the request timed-out or the port was not previously opened via the DefineVirtualPort command than this function returns (-1).

Function GetSpaceInTXBuffer(ByVal Port As Integer) As Integer

Port - 1-16

This function will return the number of bytes available in the Transmit Buffer of a port. If there is a problem accessing the OASys controller, the request timed-out or the port was not previously opened via the DefineVirtualPort command than this function returns (-1).

Function MapVirtualPort(ByVal Port As Integer, ByVal IPAddress As String, ByVal RemotePort As Integer) As Integer

Port - 1-16

IPAddress - String containing valid IP Address (exa. 101.1.1.1)

RemotePort - Remote Port number (1-4)

This function MUST be called prior to all other functions. It will define the physical address for each of the virtual ports. Once defined, all ports can be addressed in the software via their virtual address (1-16).

Function SendCommBuffer(ByVal Port As Integer) As Integer

Port - 1-16

This function will send any data placed in the comm buffer, via the BufferCommByte and BufferCommString functions, to the appropriate OASys controller. If ACKs are enabled than the OASys controller will respond to this message verifying its successful transmission.

Function SetCommAck(ByVal Mode As Integer) As Integer

Mode - 0 = ACKs disabled, 1 = ACKs enabled

This function will enable or disable ACK messages. What this means is.

If ACKs are disabled:

Only when an error is detected in the message transmission will the OASys box respond with any type of message.

If ACKs are enabled:

Each time a message is transmitted to the OASys box (virtual port) a response will be sent back to verify successful transmission. If the packet was received by the OASys box correctly, than it will return an ACK. If the packet was not successfully received, than a status byte indicating the problem will be returned.

Sample VISUAL BASIC code

To create a class instance

Set KDS = New OASysX.KDS

To close application

KDS.Shutdown

Set KDS = Nothing

To communicate with OASys

KDS.MapVideo(1,101.1.1.1,1)

KDS.MapVideo(2,101.1.1.2,1)

KDS.SetOutputMode (1)

KDS.SelectVideo (1)

KDS.SetAck (0)

KDS.ClearVideo(2, Color)

KDS.SendBlockedMsgs

To check on Acks and/or bump bar data

Temp = KDS.DequeueAck(1)

If (Temp <> -1) Then

Temp = KDS.DequeueBumpBar(1)

If (Temp <> -1) Then



Politica de confidentialitate | Termeni si conditii de utilizare



DISTRIBUIE DOCUMENTUL

Comentarii


Vizualizari: 1207
Importanta: rank

Comenteaza documentul:

Te rugam sa te autentifici sau sa iti faci cont pentru a putea comenta

Creaza cont nou

Termeni si conditii de utilizare | Contact
© SCRIGROUP 2024 . All rights reserved