ac5card.hpp
//=============================================================================
// Unified IO - C++ interface for industrial IO cards
// Copyright (C) 2000, UAB "BBD SOFT" ( http://www.bbdsoft.com/ )
//
// This material is provided "as is", with absolutely no warranty expressed
// or implied. Any use is at your own risk.
//
// Permission to use or copy this software for any purpose is hereby granted
// without fee, provided the above notices are retained on all copies.
// Permission to modify the code and to distribute modified code is granted,
// provided the above notices are retained, and a notice that the code was
// modified is included with the above copyright notice.
//
//=============================================================================
#ifndef _AC5CARD_
#define _AC5CARD_
#ifndef _UNIIO_H
#include "uniio.h"
#endif
#ifndef _IOCARD_
#include "iocard.hpp"
#endif
//-----------------------------------------------------------------------------
namespace Uniio
{
class _Export_UNIIO AC5Card : public IOCard
{
typedef IOCard Inherited;
public:
AC5Card ( const unsigned inBaseIOPort );
virtual ~AC5Card ();
unsigned baseIOPort () const;
protected:
enum AC5Constants
{
maxNumberOfBanks = 3
, maxNumberOfPoints = 8
};
virtual IOCard & updateInputs ( const IOTrack & inTrack
, long * inImage
, long & inTrackState
);
virtual IOCard & updateOutputs ( const IOTrack & inTrack
, const long * const inImage
, long & inTrackState
);
virtual IOCard & addTrack ( IOTrack & inTrack ) ;
private:
const unsigned theBaseIOPort;
unsigned char theBankMasks [maxNumberOfBanks];
}; // end AC5Card class declaration
#include "ac5card.inl"
}; // end namespace
#endif
ac5card.inl
//=============================================================================
// Unified IO - C++ interface for industrial IO cards
// Copyright (C) 2000, UAB "BBD SOFT" ( http://www.bbdsoft.com/ )
//
// This material is provided "as is", with absolutely no warranty expressed
// or implied. Any use is at your own risk.
//
// Permission to use or copy this software for any purpose is hereby granted
// without fee, provided the above notices are retained on all copies.
// Permission to modify the code and to distribute modified code is granted,
// provided the above notices are retained, and a notice that the code was
// modified is included with the above copyright notice.
//
//=============================================================================
#ifndef _AC5CARD_INL
#define _AC5CARD_INL
#ifndef _BTRACE_
#include "btrace.hpp"
#endif
//-----------------------------------------------------------------------------
inline unsigned AC5Card::baseIOPort () const
{
BFUNCTRACE_ALL ();
return theBaseIOPort;
} // end AC5Card::baseIOPort () const
#endif
ac5card.cpp
//=============================================================================
// Unified IO - C++ interface for industrial IO cards
// Copyright (C) 2000, UAB "BBD SOFT" ( http://www.bbdsoft.com/ )
//
// This material is provided "as is", with absolutely no warranty expressed
// or implied. Any use is at your own risk.
//
// Permission to use or copy this software for any purpose is hereby granted
// without fee, provided the above notices are retained on all copies.
// Permission to modify the code and to distribute modified code is granted,
// provided the above notices are retained, and a notice that the code was
// modified is included with the above copyright notice.
//
//=============================================================================
#ifndef _BTRACE_
#include "btrace.hpp"
#endif
#ifndef _AC5CARD_
#include "ac5card.hpp"
#endif
#ifndef _STDEXCEPT_
#include
#endif
#ifndef _IOPORT_
#include "ioport.hpp"
#endif
#ifndef _IOTRACK_
#include "iotrack.hpp"
#endif
using namespace std;
using namespace Uniio;
//-----------------------------------------------------------------------------
AC5Card::AC5Card ( const unsigned inBaseIOPort )
: IOCard ("AC5")
, theBaseIOPort ( inBaseIOPort )
{
BFUNCTRACE_DEVELOP ();
if ( theBaseIOPort % 0x10
|| theBaseIOPort < 0x220
|| theBaseIOPort > 0x3E0
|| theBaseIOPort == 0x270
)
{
logic_error exc ("AC5 card: invalid base IO port number specified.");
throw exc;
} // endif
} // end constructor
//-----------------------------------------------------------------------------
AC5Card::~AC5Card ()
{
BFUNCTRACE_DEVELOP ();
} // end destructor
//-----------------------------------------------------------------------------
IOCard & AC5Card::updateInputs ( const IOTrack & inTrack
, long * inImage
, long & inTrackState
)
{
BFUNCTRACE_DEVELOP ();
for ( int i = inTrack.startingPoint()
; i < inTrack.startingPoint() + inTrack.numberOfPoints()/maxNumberOfPoints
; i++)
{
// to increase processing speed update only banks that have at least one input
if ( theBankMasks[i] != 0xff )
{
IOPort dataRegister ( baseIOPort() + i*2
, false // write access not required
);
unsigned char newValue = dataRegister.readChar ();
// AC5 card used inverted logic - 0 means ON, and 1 means OFF
newValue = ~newValue;
for (int j = 0; j
Back to US Digital PC7166 card description
Back to Unified IO description
Copyright © 2000 UAB "BBD SOFT"
All Rights Reserved.
All brand names and products names are trademarks or registered trademarks of their respective companies.