⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pmpslavewritebuffern.c

📁 Mplab C30编译器
💻 C
字号:
#if defined(__PIC24F__)
#include <p24Fxxxx.h>
#endif
#include "pmp.h"



#ifdef _PPI_PMP_V1

/******************************************************************************
 * Function:        PMPSlaveWriteBufferN
 *
 * PreCondition:    None
 *
 * Side Effects:    None
 *
 * Overview:        writes the desired value into the selected output buffer
 * 					
 * Input:           buf - buffer(0..3)
 *                  value - value to be written
 *
 * Output:          Returns the state of PMSTAT.OBE prior to the write operation.
 *
 * Note:            Use in SLAVE BUFFERED mode, MODE[1:0] = 00
 *					or SLAVE ENHANCED mode, MODE[1:0] = 00  and INCM[1:0]=11           
 *****************************************************************************/
BOOL PMPSlaveWriteBufferN(BUFFER buf, BYTE value)
{

	WORD_VAL reg;
	BOOL status;
	reg.Val = 0;
	
	if(PMSTATbits.OBE)	
		status = TRUE;

	switch(buf)
	{
	case 0:
		reg.Val = PMADDR;				// copy upper/lower bytes of PMDATAOUT1 into temp
		reg.v[0] = value;				// update lower byte only
		PMADDR = reg.Val;				// write it back to PMDATAOUT1
		break;

	case 1:
		reg.Val = PMADDR;				// copy upper/lower bytes of PMDATAOUT1 into temp
		reg.v[1] = value;				// update upper byte only
		PMADDR = reg.Val;				// write it back to PMDATAOUT1
		break;

	case 2:
		reg.Val = PMDOUT2;				// copy upper/lower bytes of PMDATAOUT2 into temp
		reg.v[0] = value;					// update lower byte only
		PMDOUT2 = reg.Val;				// write it back to PMDATAOUT2
		break;
		
	case 3:
		reg.Val = PMDOUT2;				// copy upper/lower bytes of PMDATAOUT2 into temp
		reg.v[1] = value;					// update upper byte only
		PMDOUT2 = reg.Val;				// write it back to PMDATAOUT2
		break;
	}
	return(status);
}

/* end of file */
#else
#warning "Does not build on this target"
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -