ad5.c

来自「cap口例程」· C语言 代码 · 共 58 行

C
58
字号
//
//      TMDX ALPHA RELEASE
//      Intended for product evaluation purposes
//
//###########################################################################
//
// FILE:	DSP28_Example.c
//
// TITLE:	DSP28 CPU_Timer example program.
//
//###########################################################################
//
//  Ver | dd mmm yyyy | Who  | Description of changes
// =====|=============|======|===============================================
//  0.55| 06 May 2002 | S.S. | EzDSP Alpha Release
//  0.57| 27 May 2002 | L.H. | No change
//###########################################################################

// Step 0.  Include required header files
         // DSP28_Device.h: device specific definitions #include statements for
         // all of the peripheral .h definition files.
         // DSP28_Example.h is specific for the given example.  

#include "DSP28_Device.h"

extern  unsigned int a1[128];
extern  unsigned int a2;
volatile Uint16 *count=(volatile Uint16 *)0x9FFF;
float   b[128];

// Prototype statements for functions found within this file.
interrupt void ad(void);

// Step 7. Insert all local Interrupt Service Routines (ISRs) and functions here:	
	// If local ISRs are used, reassign vector addresses in vector table as
    // shown in Step 5

interrupt void ad(void)
{
	IFR=0x0000;
	PieCtrl.PIEACK.all=0xFFFF;
    GpioDataRegs.GPATOGGLE.bit.GPIOA0=1;      

    *count=AdcRegs.ADCRESULT8>>4;
    a1[a2]=(*count);
    b[a2]=((float)a1[a2]/4095*3.0);
    a2++;
  // Reinitialize for next ADC sequence
//  AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1;         // Reset SEQ1
//	AdcRegs.ADCTRL2.bit.RST_SEQ2 = 1;
	AdcRegs.ADCST.bit.INT_SEQ1_CLR=1;
	EINT;
}

//===========================================================================
// No more.
//===========================================================================

⌨️ 快捷键说明

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