Пример #1
0
void DRV_PMP0_TimingSet(PMP_DATA_WAIT_STATES dataWait,
                   PMP_STROBE_WAIT_STATES strobeWait,
                   PMP_DATA_HOLD_STATES dataHold)
{
   /* Configure the wait states */
    PLIB_PMP_WaitStatesDataSetUpSelect(PMP_ID_0, dataWait);
    PLIB_PMP_WaitStatesStrobeSelect(PMP_ID_0, strobeWait);
    PLIB_PMP_WaitStatesDataHoldSelect(PMP_ID_0, dataHold);
}
/**
 * @brief You must set mode configuration after initial driver.
 * @param void
 * @return void
 */
void DRV_PMP0_ModeConfig(void)
{
    PLIB_PMP_Disable(PMP_ID_0);

    //Configure Main Communication Mode
    PLIB_PMP_OperationModeSelect(PMP_ID_0, PMP_MASTER_READ_WRITE_STROBES_INDEPENDENT);

    // Set the multiplexing to PMP_MUX_LINES_16_ADDRESS_16_DATA. Address and data lines are multiplexed.
    PLIB_PMP_MultiplexModeSelect( PMP_ID_0, PMP_MUX_LINES_16_ADDRESS_16_DATA );

    // Select the interrupt mode
    PLIB_PMP_InterruptModeSelect( PMP_ID_0, PMP_INTERRUPT_NONE );

    // disable the auto increment/decrement of address after each read/write
    PLIB_PMP_AddressIncrementModeSelect( PMP_ID_0, PMP_ADDRESS_AUTO_INCREMENT );

    // Enable stop in Idle mode.
    PLIB_PMP_ExistsStopInIdleControl( PMP_ID_0 );

    //Set the data width size
    PLIB_PMP_DataSizeSelect(PMP_ID_0, PMP_DATA_SIZE_16_BITS);

    //Setup Read Strobe Registers
    PLIB_PMP_ReadWriteStrobePortEnable(PMP_ID_0);
    PLIB_PMP_ReadWriteStrobePolaritySelect(PMP_ID_0, PMP_POLARITY_ACTIVE_LOW);

    //Setup Write Strobe Registers
    PLIB_PMP_WriteEnableStrobePortEnable(PMP_ID_0);
    PLIB_PMP_WriteEnableStrobePolaritySelect(PMP_ID_0, PMP_POLARITY_ACTIVE_LOW);

    // Configure the wait states
    PLIB_PMP_WaitStatesDataSetUpSelect(PMP_ID_0, PMP_DATA_WAIT_TWO);
    PLIB_PMP_WaitStatesStrobeSelect(PMP_ID_0, PMP_STROBE_WAIT_3);
    PLIB_PMP_WaitStatesDataHoldSelect(PMP_ID_0, PMP_DATA_HOLD_2);

    // Enable address latch pin
    PLIB_PMP_AddressLatchStrobeEnable( PMP_ID_0, PMP_ADDRESS_LATCH_HIGH | PMP_ADDRESS_LATCH_LOW);

    PLIB_PMP_Enable(PMP_ID_0);
}
Пример #3
0
void DRV_PMP0_ModeConfig(void)
{

    /*Configure Main Communication Mode */    
    PLIB_PMP_OperationModeSelect(PMP_ID_0, PMP_MASTER_READ_WRITE_STROBES_INDEPENDENT);

    /*Set the data width size*/
    PLIB_PMP_DataSizeSelect(PMP_ID_0, PMP_DATA_SIZE_8_BITS);
    /*Setup Read Strobe Registers */    
    PLIB_PMP_ReadWriteStrobePortEnable(PMP_ID_0);
    PLIB_PMP_ReadWriteStrobePolaritySelect(PMP_ID_0, PMP_POLARITY_ACTIVE_LOW);
    /*Setup Write Strobe Registers */
    PLIB_PMP_WriteEnableStrobePortEnable(PMP_ID_0);
    PLIB_PMP_WriteEnableStrobePolaritySelect(PMP_ID_0, PMP_POLARITY_ACTIVE_LOW);


    /* Configure the wait states */
    PLIB_PMP_WaitStatesDataSetUpSelect(PMP_ID_0, PMP_DATA_WAIT_ONE);
    PLIB_PMP_WaitStatesStrobeSelect(PMP_ID_0, PMP_STROBE_WAIT_6);
    PLIB_PMP_WaitStatesDataHoldSelect(PMP_ID_0, PMP_DATA_HOLD_1);

}