发表于:2008-12-11 09:38:04
楼主
问题的提出:在控制红外灯开闭的时候,我们需要一个从dsp上引出的触发信号,这里我们使用数字IO口
问题的解决:
数字IO口在合众达板子上是通过cpld输出,cpld的地址是:
#define SEEDDM642_CPLD_BASE 0x90080000
而* CPLD Register Indices */
#define SEEDDM642_IOOUT 0x10 //write only
#define SEEDDM642_IOINPUT 0x10 //read only
#define SEEDDM642_FLASHPAGE 0x11 //write only
#define EVMDM642_THRESHMSB 0x12
#define EVMDM642_ISR 0x13
#define EVMDM642_IER 0x14
#define EVMDM642_GPIODIR 0x15
#define EVMDM642_GPIOSTAT 0x16
数字IO口占:0x10 ,所以输出信号可以通过这个cpld来设置:
SEEDDM642_rset(SEEDDM642_IOOUT,1);
/* Write an 8-bit value to a CPLD register */
void SEEDDM642_rset(Int16 regnum, Uint8 regval)
{
Uint8 *pdata;
/* Write lower 8 bits of register */
pdata = (Uint8 *)(SEEDDM642_CPLD_BASE + regnum);
*pdata = (regval & 0xff);
}