Herunterladen Inhalt Inhalt Diese Seite drucken

Programm Zum Überprüfen Der I/O-Adressen - Pepperl+Fuchs VAM-CTR-PC2 Handbuch

Inhaltsverzeichnis

Werbung

until (1<>1);
end.
{ END OF PROGRAM
{ ============================================================= }
10.4.3 Programm zum Überprüfen der I/O-Adressen
/*********************************************************************
*
*
error = CheckAsiPc2 (IOport);
*
*
description:
*
checks, if a AS-i PC2 board is present at the given I/O address
*
*
parameters:
*
IOport: I/O address of AS-i PC2 to check
*
*
returns:
*
0:
AS-i PC2 found at IOport
*
1:
IOport out of range
*
2:
no PC2 found at IOport
*
3:
no PC2 found at IOport */
static int CheckAsiPc2 (int IOport)
{
register int i;
static unsigned char TestPad [512];
static char AsiPc2Name = "AS-i PC2";
/* IOport out of range */
if ((0x100 > IOport) || (0x3FF < IOport) || (0 != (0x0003 & IOport)))
return (1);
/* read page 0 */
for (i = 0; sizeof (TestPad) > i; i++)
TestPad [i] = (unsigned char) inp (IOport +O_DATA);
Zumutbare Änderungen aufgrund technischer Verbesserungen vorbehalten.
Pepperl+Fuchs GmbH · 68301 Mannheim · Telefon (06 21) 7 76-11 11 · Telefax (06 21) 7 76-10 00 · Internet http://www.pepperl-fuchs.com
{ read execution control flags from DPRAM }
DPread(flags);
{ copy sensor bit of slave 1 to bit 0 of slave 2 }
odata[1] := idata[0] AND $10;
odata[1] := odata[1] shr 4;
odata[1] := NOT odata[1];
{ write output data to DPRAM }
for i:=0 to 15 do
DPwrite( odata[i] );
{ print data to screen ('shift-' and 'AND-operation' }
{ necessary for right placing on screen!) }
write(' input data (slave 1) = ', idata[0] shr 4);
write(' output data (slave 2)= ', odata[1] AND $0F);
{ print 'config OK' or 'config err' to screen }
if (flags AND $01 = $00) then { mask config flag }
writeln(' config err...')
else
writeln(' config OK... ');
{ communication for ever }
AS-i PC2 Karte
{ mask sensor bit of sl.1 }
{ shift from sl.3 to sl.2 }
{ bitwise negation }
}
Copyright Pepperl+Fuchs, Printed in Germany
Anhang
47

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis