Ejemplo n.º 1
0
void Encoder::_pcapInit(void) {
	_filterAndSampleWindowInit(mcn, mdn);
	
	mcsif_SetMode(mcn, mdn, MCSIF_PFAU);
	
    mcpfau_SetCapMode1(mcn, mdn, MCPFAU_CAP_BOTH_CLEAR);
    mcpfau_SetCapInterval1(mcn, mdn, 1L);             
    mcpfau_SetCap1INT(mcn, mdn, 0L);
    mcpfau_SetPolarity1(mcn, mdn, MCPFAU_POL_NORMAL);
    mcpfau_SetMask1(mcn, mdn, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG1(mcn, mdn, MCPFAU_RLDTRIG_DISABLE);
    mcpfau_SetFAU1TRIG(mcn, mdn, MCPFAU_FAUTRIG_INPUT1);
    mcpfau_SetFAU1RELS(mcn, mdn, MCPFAU_FAURELS_INPUT0);
	
    mcpfau_SetCapMode2(mcn, mdn, MCPFAU_CAP_BOTH_CLEAR);     
    mcpfau_SetCapInterval2(mcn, mdn, 1L);
    mcpfau_SetCap2INT(mcn, mdn, 0L);
    mcpfau_SetPolarity2(mcn, mdn, MCPFAU_POL_NORMAL);
    mcpfau_SetMask2(mcn, mdn, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG2(mcn, mdn, MCPFAU_RLDTRIG_DISABLE);
    mcpfau_SetFAU2TRIG(mcn, mdn, MCPFAU_FAUTRIG_INPUT1);
    mcpfau_SetFAU2RELS(mcn, mdn, MCPFAU_FAURELS_INPUT0);

    mcpfau_SetCapMode3(mcn, mdn, MCPFAU_CAP_BOTH_CLEAR);
    mcpfau_SetCapInterval3(mcn, mdn, 1L);
    mcpfau_SetCap3INT(mcn, mdn, 0L);
    mcpfau_SetPolarity3(mcn, mdn, MCPFAU_POL_NORMAL);
    mcpfau_SetMask3(mcn, mdn, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG3(mcn, mdn, MCPFAU_RLDTRIG_DISABLE);          
	mcpfau_SetFAU3TRIG(mcn, mdn, MCPFAU_FAUTRIG_INPUT1);
	mcpfau_SetFAU3RELS(mcn, mdn, MCPFAU_FAURELS_INPUT0);
	
#if defined (DMP_DOS_BC) || (DMP_DOS_DJGPP)
    io_DisableINT();
#elif defined (DMP_LINUX)
	OSSPINLOCK(encvar);
#endif

	_mcmode[mcn] = MODE_CAPTURE;

#if defined (DMP_DOS_BC) || (DMP_DOS_DJGPP)
	io_RestoreINT();
#elif defined (DMP_LINUX)
	OSSPINUNLOCK(encvar);
#endif
}
Ejemplo n.º 2
0
DMP_INLINE(void) mcmsif_init(int32_t mc)
{
    mcsif_SetInputFilter(mc, MCSIF_MODULEB, 20L);
    mcsif_SetSWDeadband(mc, MCSIF_MODULEB, 0L);
    mcsif_SetSWPOL(mc, MCSIF_MODULEB, MCSIF_SWPOL_REMAIN);
    mcsif_SetSamplWin(mc, MCSIF_MODULEB, MCSIF_SWSTART_DISABLE + MCSIF_SWEND_NOW);
    mcsif_SetSamplWin(mc, MCSIF_MODULEB, MCSIF_SWSTART_NOW + MCSIF_SWEND_DISABLE);

    mcsif_SetMode(mc, MCSIF_MODULEB, MCSIF_PFAU);               // enable MC2 SIFA

    mcpfau_SetCapMode1(mc, MCSIF_MODULEB, MCPFAU_CAP_DISABLE);
    mcpfau_SetCapInterval1(mc, MCSIF_MODULEB, 1L);              // pin1 for FAUTRIG
    mcpfau_SetCap1INT(mc, MCSIF_MODULEB, 1L);
    mcpfau_SetPolarity1(mc, MCSIF_MODULEB, MCPFAU_POL_NORMAL);
    mcpfau_SetMask1(mc, MCSIF_MODULEB, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG1(mc, MCSIF_MODULEB, MCPFAU_RLDTRIG_DISABLE);
    mcpfau_SetFAU1TRIG(mc, MCSIF_MODULEB, MCPFAU_FAUTRIG_INPUT1);
    mcpfau_SetFAU1RELS(mc, MCSIF_MODULEB, MCPFAU_FAURELS_INPUT0);

    mcpfau_SetCapMode2(mc, MCSIF_MODULEB, MCPFAU_CAP_DISABLE);     // pin2 for RLDTRIG
    mcpfau_SetCapInterval2(mc, MCSIF_MODULEB, 1L);
    mcpfau_SetCap2INT(mc, MCSIF_MODULEB, 1L);
    mcpfau_SetPolarity2(mc, MCSIF_MODULEB, MCPFAU_POL_NORMAL);
    mcpfau_SetMask2(mc, MCSIF_MODULEB, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG2(mc, MCSIF_MODULEB, MCPFAU_RLDTRIG_DISABLE);
    mcpfau_SetFAU2TRIG(mc, MCSIF_MODULEB, MCPFAU_FAUTRIG_INPUT1);
    mcpfau_SetFAU2RELS(mc, MCSIF_MODULEB, MCPFAU_FAURELS_INPUT0);

    mcpfau_SetCapMode3(mc, MCSIF_MODULEB, MCPFAU_CAP_DISABLE);
    mcpfau_SetCapInterval3(mc, MCSIF_MODULEB, 1L);              // pin3 for FAUTRIG
    mcpfau_SetCap3INT(mc, MCSIF_MODULEB, 1L);
    mcpfau_SetPolarity3(mc, MCSIF_MODULEB, MCPFAU_POL_NORMAL);
    mcpfau_SetMask3(mc, MCSIF_MODULEB, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG3(mc, MCSIF_MODULEB, MCPFAU_RLDTRIG_DISABLE);
    mcpfau_SetFAU3TRIG(mc, MCSIF_MODULEB, MCPFAU_FAUTRIG_INPUT1);
    mcpfau_SetFAU3RELS(mc, MCSIF_MODULEB, MCPFAU_FAURELS_INPUT0);
#if defined (DMP_DOS_DJGPP)
    io_DisableINT();
#endif
    mcm_init[mc] = true;
#if defined (DMP_DOS_DJGPP)
    io_RestoreINT();
#endif
}
Ejemplo n.º 3
0
static void mcmsif_init(void) {
    if(mcm_init[mc] == true) return;
    
    mcsif_SetInputFilter(mc, md, 20L);
    mcsif_SetSWDeadband(mc, md, 0L);
    mcsif_SetSWPOL(mc, md, MCSIF_SWPOL_REMAIN);
    mcsif_SetSamplWin(mc, md, MCSIF_SWSTART_DISABLE + MCSIF_SWEND_NOW);  // stop the current sampling window first
    mcsif_SetSamplWin(mc, md, MCSIF_SWSTART_NOW + MCSIF_SWEND_DISABLE);

	mcsif_SetMode(mc, md, MCSIF_PFAU);               // enable MC2 SIFA
    
    mcpfau_SetCapMode1(mc, md, MCPFAU_CAP_DISABLE);
    mcpfau_SetCapInterval1(mc, md, 1L);              // pin1 for FAUTRIG
    mcpfau_SetCap1INT(mc, md, 1L);
    mcpfau_SetPolarity1(mc, md, MCPFAU_POL_NORMAL);
    mcpfau_SetMask1(mc, md, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG1(mc, md, MCPFAU_RLDTRIG_DISABLE);
    mcpfau_SetFAU1TRIG(mc, md, MCPFAU_FAUTRIG_INPUT1);
    mcpfau_SetFAU1RELS(mc, md, MCPFAU_FAURELS_INPUT0);
	
    mcpfau_SetCapMode2(mc, md, MCPFAU_CAP_DISABLE);     // pin2 for RLDTRIG
    mcpfau_SetCapInterval2(mc, md, 1L);
    mcpfau_SetCap2INT(mc, md, 1L);
    mcpfau_SetPolarity2(mc, md, MCPFAU_POL_NORMAL);
    mcpfau_SetMask2(mc, md, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG2(mc, md, MCPFAU_RLDTRIG_DISABLE);
    mcpfau_SetFAU2TRIG(mc, md, MCPFAU_FAUTRIG_INPUT1);
    mcpfau_SetFAU2RELS(mc, md, MCPFAU_FAURELS_INPUT0);

    mcpfau_SetCapMode3(mc, md, MCPFAU_CAP_DISABLE);
    mcpfau_SetCapInterval3(mc, md, 1L);              // pin3 for FAUTRIG 
    mcpfau_SetCap3INT(mc, md, 1L);
    mcpfau_SetPolarity3(mc, md, MCPFAU_POL_NORMAL);
    mcpfau_SetMask3(mc, md, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG3(mc, md, MCPFAU_RLDTRIG_DISABLE);          
	mcpfau_SetFAU3TRIG(mc, md, MCPFAU_FAUTRIG_INPUT1);
	mcpfau_SetFAU3RELS(mc, md, MCPFAU_FAURELS_INPUT0);
	
	io_DisableINT();
	mcm_init[mc] = true;
	io_RestoreINT();
}
Ejemplo n.º 4
0
void Encoder::_pcapInit(void) {
	_filterAndSampleWindowInit(mcn, mdn);
	
	mcsif_SetMode(mcn, mdn, MCSIF_PFAU);
	
    mcpfau_SetCapMode1(mcn, mdn, MCPFAU_CAP_BOTH_CLEAR);
    mcpfau_SetCapInterval1(mcn, mdn, 1L);             
    mcpfau_SetCap1INT(mcn, mdn, 0L);
    mcpfau_SetPolarity1(mcn, mdn, MCPFAU_POL_NORMAL);
    mcpfau_SetMask1(mcn, mdn, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG1(mcn, mdn, MCPFAU_RLDTRIG_DISABLE);
    mcpfau_SetFAU1TRIG(mcn, mdn, MCPFAU_FAUTRIG_INPUT1);
    mcpfau_SetFAU1RELS(mcn, mdn, MCPFAU_FAURELS_INPUT0);
	
    mcpfau_SetCapMode2(mcn, mdn, MCPFAU_CAP_BOTH_CLEAR);     
    mcpfau_SetCapInterval2(mcn, mdn, 1L);
    mcpfau_SetCap2INT(mcn, mdn, 0L);
    mcpfau_SetPolarity2(mcn, mdn, MCPFAU_POL_NORMAL);
    mcpfau_SetMask2(mcn, mdn, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG2(mcn, mdn, MCPFAU_RLDTRIG_DISABLE);
    mcpfau_SetFAU2TRIG(mcn, mdn, MCPFAU_FAUTRIG_INPUT1);
    mcpfau_SetFAU2RELS(mcn, mdn, MCPFAU_FAURELS_INPUT0);

    mcpfau_SetCapMode3(mcn, mdn, MCPFAU_CAP_BOTH_CLEAR);
    mcpfau_SetCapInterval3(mcn, mdn, 1L);
    mcpfau_SetCap3INT(mcn, mdn, 0L);
    mcpfau_SetPolarity3(mcn, mdn, MCPFAU_POL_NORMAL);
    mcpfau_SetMask3(mcn, mdn, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG3(mcn, mdn, MCPFAU_RLDTRIG_DISABLE);          
	mcpfau_SetFAU3TRIG(mcn, mdn, MCPFAU_FAUTRIG_INPUT1);
	mcpfau_SetFAU3RELS(mcn, mdn, MCPFAU_FAURELS_INPUT0);
	
	io_DisableINT();
	_mcmode[mcn] = MODE_CAPTURE;
	io_RestoreINT();
}