资源简介
AD2S1210并行通讯源码,实际运行无数,给想学的朋友一个参考
代码片段和文件信息
/* BEGIN_FILE_HDR
***********************************************************************************************
* Copyright (C) 2010-2013 FORTH Shanghai
***********************************************************************************************
* File Name :
***********************************************************************************************
* Author : admin
***********************************************************************************************
* Description :
*
***********************************************************************************************
* Revision History:
*
* Version Date author CR# Descriptions
* --------- ---------- ------------ ---------- ---------------
* V1.0 2016/10/18 admin N/A Original
***********************************************************************************************
* END_FILE_HDR*/
#include “IfxPort.h“
#include “RDC_ADS1210.h“
#include “DevTest.h“
#define RESOLVER_COEFF 2*PI/4095
//mode
#define MODE_POSITION 0
#define MODE_VELOCITY 1
#define MODE_REV 2
#define MODE_CONFIG 3
//
#define RDC_READ 0
#define RDC_WRITE 1
//wr
#define RDC_WR_HIGH() IfxPort_setPinState(&MODULE_P21 5 IfxPort_State_high)
#define RDC_WR_LOW() IfxPort_setPinState(&MODULE_P21 5 IfxPort_State_low)
//RD
#define RDC_RD_HIGH() IfxPort_setPinState(&MODULE_P21 4 IfxPort_State_high)
#define RDC_RD_LOW() IfxPort_setPinState(&MODULE_P21 4 IfxPort_State_low)
//data
#define RDC_DATA_R() IfxPort_getGroupState(&MODULE_P33 0 0x0fff)
#define RDC_DATA_W(data) IfxPort_setGroupState(&MODULE_P33 0 0x0fff data)
//cs
#define RDC_CS_HIGH() IfxPort_setPinState(&MODULE_P21 6 IfxPort_State_high)
#define RDC_CS_LOW() IfxPort_setPinState(&MODULE_P21 6 IfxPort_State_low)
//sample
#define RDC_SAMPLE_HIGH() IfxPort_setPinState(&MODULE_P22 1 IfxPort_State_high)
#define RDC_SAMPLE_LOW() IfxPort_setPinState(&MODULE_P22 1 IfxPort_State_low)
//SOE
#define RDC_SOE_SERIAL() IfxPort_setPinState(&MODULE_P22 0 IfxPort_State_low) //serial mode =0
#define RDC_SOE_PARALLEL() IfxPort_setPinState(&MODULE_P22 0 IfxPort_State_high) //parallel mode =1
//reset
#define RDC_RESET_HIGH() IfxPort_setPinState(&MODULE_P22 2 IfxPort_State_high)
#define RDC_RESET_LOW() IfxPort_setPinState(&MODULE_P22 2 IfxPort_State_low)
//data direction
#define RDC_DIRECTION_RD() IfxPort_setPinState(&MODULE_P21 3 IfxPort_State_low) //=0
#define RDC_DIRECTION_WR() IfxPort_setPinState(&MODULE_P21 3 IfxPort_State_high) //=1
void RDC_PortDir_Set(unsigned char portDir) //0=in/read;1=out/write
{
if(RDC_READ==portDir)
{
RDC_DIRECTION_RD();
//P13_0----P13_15 initial to input
IfxPort_setGroupModeInput(&MODULE_P33 0 0x0fff IfxPort_InputMode_noPullDevice);
}
else
{
RDC_DIRECTION_WR();
IfxPort_setGroupModeOut
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1555 2017-10-09 14:52 RDC_ADS1210.h
文件 783439 2012-07-02 16:10 AD2S1210_cn.pdf
文件 10786 2017-12-26 14:33 RDC_ADS1210.c
----------- --------- ---------- ----- ----
795780 3
评论
共有 条评论