20.11.2014 Views

Proyecto REX-2X - Radio Observatorio de Jicamarca

Proyecto REX-2X - Radio Observatorio de Jicamarca

Proyecto REX-2X - Radio Observatorio de Jicamarca

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

JICA<strong>REX</strong>LIB.CPP<br />

#inclu<strong>de</strong> "JicaRexLIB.h"<br />

namespace Func<strong>Jicamarca</strong><br />

{<br />

CNIDAQConfig::CNIDAQConfig()<br />

{ m_iPortData =3;<br />

m_iPortControl =4;<br />

m_giDevice = 1;<br />

m_giGroup = 1;<br />

}<br />

void CNIDAQConfig::ConfigureExternalBoards()<br />

{ m_iStatus = DIG_Out_Line( m_giDevice,m_iPortControl,1,1);<br />

DAQERROR(m_iStatus, "DIG_Out_Line");<br />

}<br />

void CNIDAQConfig::CleanupNIDAQEvents()<br />

{ Config_DAQ_Event_Message(m_giDevice, 0,"",1, 0, 0, 0, 0, 0, 0, 0, 0);<br />

m_iStatus = DIG_Block_Clear(m_giDevice,m_giGroup);<br />

DAQERROR(m_iStatus, "DIG_Block_Clear");<br />

m_iStatus = DIG_Grp_Config(m_giDevice, m_giGroup, 0, 0, 0);<br />

DAQERROR(m_iStatus, "DIG_Grp_Config");<br />

}<br />

void CNIDAQConfig::Configure_Burst_Mo<strong>de</strong>()<br />

{ m_iIgnoreWarning = 0;<br />

m_iStatus = 0;<br />

m_iRetVal = 0;<br />

m_giDevice = 1;<br />

m_giGroup = 1;<br />

m_iGroupSize = 4; // group size 32bits<br />

m_iPort = 0;<br />

m_iDir = 0;<br />

m_ulRemaining = 1;<br />

m_iStatus=DIG_Grp_Config(m_giDevice, m_giGroup,m_iGroupSize,m_iPort,m_iDir);<br />

DAQERROR(m_iStatus, "DIG_Grp_Config");<br />

m_iRetVal = NIDAQErrorHandler(m_iStatus, "DIG_Grp_Config",m_iIgnoreWarning);<br />

/* Configure handshaking parameters for burst mo<strong>de</strong> handshaking */<br />

m_iProtocol = 3; //Group is configured for burst handshaking, using the REQ, ACK, and<br />

PCLK signals<br />

m_iEdge<br />

= 1; //1 Group is configured for leading-edge pulsed handshake signals.<br />

m_iReqPol = 0; //Group is configured for active high (non-inverted) request handshake<br />

signal polarity.<br />

m_iAckPol = 0; //Group is configured for active high (non-inverted) acknowledge<br />

handshake signal polarity.<br />

m_iAckDelayTime = 0; //0 =50ns,1=100ns<br />

m_iStatus = DIG_Grp_Mo<strong>de</strong>( m_giDevice,<br />

m_giGroup,m_iProtocol,m_iEdge,m_iReqPol,m_iAckPol,m_iAckDelayTime);<br />

m_iRetVal = NIDAQErrorHandler(m_iStatus, "DIG_Grp_Mo<strong>de</strong>", m_iIgnoreWarning);<br />

/*cambio doublebuffer*/<br />

u16 iDBMo<strong>de</strong>ON = 1;<br />

// u16 iDBMo<strong>de</strong>OFF = 0;<br />

u16 iOldDataStop = 1;<br />

u16 iPartialTransfer = 0;<br />

m_iStatus = DIG_DB_Config(m_giDevice, m_giGroup, iDBMo<strong>de</strong>ON, iOldDataStop,iPartialTransfer);<br />

m_iRetVal = NIDAQErrorHandler(m_iStatus, "DB_COnfig",m_iIgnoreWarning);<br />

/*cambio doublebuffer*/<br />

}<br />

void CNIDAQConfig::StartAcquisition()<br />

{<br />

m_iStatus = DIG_Out_Line(m_giDevice,m_iPortControl,1,0);<br />

m_iStatus = DIG_Out_Line(m_giDevice,m_iPortControl,3,1);<br />

Sleep(40);<br />

}<br />

void CNIDAQConfig::PortDOut()<br />

{ m_iStatus = 0; //<br />

i16 iMo<strong>de</strong> = 0; //no handshaking<br />

m_iDir = 1; //output<br />

m_giDevice = 1; //<br />

/* Configure port as output, no handshaking. */<br />

49

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!