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

📄 funlib.h

📁 dsp2407的函数库
💻 H
字号:
/****************************************************************
*	funlib.h													*
*	Don Luebbe													*
*	10/12/02													*
*                                                               *
*	This file is the header file for the ME102B function library*
*	and serves as general documentation for the library.  In	*
*	order to use the function libary three things must be done: *
*		1.	Include this header file in your main C file.		*
*		2.	Associate the C files that define the functions that*
*			you would like to use with your project.			*						*
*		3.	Be aware of the global variables, function names, 	*
*			and hardware in use when coding in order to avoid 	*
*			conflicts.											*
*	These functions provide the abilities as follows:			*
*		1.	Initialize the DSP in general with one function.	*
*		2.	Setup a variable that provides time in seconds since*
*			the function was called.  This function is based off*
*			of the CPU clock and can be consider accurate if the*
*			variable is regularly updated.						*
*		3.	Easily setup the ADC and read either one channel at *
*			a time, or all channels at once.					*
*		4.	Setup pairs of pins as PWM outputs and update their *
*			duty cycles as needed.								*
*		5.	Initialize up to two QEP circuit for use with 		*
*			optical encoders, and check their position with one *
*			function.											*
*	For a detailed explanation of how the function works, please*
*	read TI's TMS320LF/L240xA DSP Controllers Reference Guide:	*
*	System and Peripherials (spru357b), Spectrum Digital's eZdsp*
*	LF2407 Technical Reference,	the classes notes, or speak with*
*	a GSI. 														*
****************************************************************/

#ifndef _funlib
#define _funlib

/* symbolic constants used in function library*/
#define CPUCLOCKFREQ 40000000

extern int 		timerasclock;
extern int 		prescale;
extern int 		clockprescale;
extern long 	coarsecount;
extern int 		finecount;
extern int 		finecountlast;
extern double 	secsperfine;
extern double 	secspercoarse;
extern double 	clocktime;
extern int 		timer;

#define INPUT   0
#define OUTPUT  1
#define IOPA    1
#define IOPB    2
#define IOPC    3
#define IOPD    4
#define IOPE    5
#define IOPF    6

extern int      ADCchannels[];
extern int 		ADCresults[];

/* general prototypes */
void initGen(void);

/* clock prototypes */
int initClock(int, int);
int updateClock(void);

/* io prototypes */
int initIO(int, int, int);
int getIO(int, int);
int setIO(int, int, int);

/* pwm prototypes */
int initPWM(int, int);
int setPWM(int, int);

/* qep prototypes */
int initQEP(int, int);
int getQEP(int);

/* adc prototypes */
int initADC(void);
int getADC(int);
int getAllADC(int);

#endif

⌨️ 快捷键说明

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