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

📄 dsp28_defaultisr.c

📁 单个表头的显示 运用了MAX7219驱动芯片
💻 C
📖 第 1 页 / 共 3 页
字号:
//###########################################################################
//
// FILE:	DSP28_DefaultIsr.c
//
// TITLE:	DSP28 Device Default Interrupt Service Routines.
//
//###########################################################################
//
//  Ver | dd mmm yyyy | Who  | Description of changes
// =====|=============|======|===============================================
//  0.55| 06 May 2002 | L.H. | EzDSP Alpha Release
//  0.56| 20 May 2002 | L.H. | No change
//  0.57| 27 May 2002 | L.H. | No change
//###########################################################################
#include "DSP28_Device.h"
#pragma DATA_SECTION(f,"DATA_TABLE");
Uint16 f[1901]={46875,46411,45956,45510,45072,44643,44222,43808,43403,43005,42614,42230,41853,41482,41118,40761,40409,40064,39725,39391,39063,38740,38422,38110,37802,37500,37202,36909,36621,36337,36058,35782,35511,35244,34981,34722,34467,34215,33967,33723,33482,33245,33011,32780,32552,32328,32106,31888,31672,31460,31250,31043,30839,30637,30438,30242,30048,29857,29668,29481,29297,29115,28935,28758,28582,28409,28238,28069,27902,27737,27574,27412,27253,27095,26940,26786,26634,26483,26334,26187,26042,25898,25755,25615,25476,25338,25202,25067,24934,24802,24671,24542,24414,24288,24162,24038,23916,23794,23674,23555,23438,23321,23205,23091,22978,22866,22755,22645,22536,22428,22321,22216,22111,22007,21904,21802,21701,21601,21502,21404,21307,21210,21115,21020,20926,20833,20741,20650,20559,20469,20380,20292,20205,20118,20032,19947,19862,19778,19695,19613,19531,19450,19370,19290,19211,19133,19055,18978,18901,18825,18750,18675,18601,18528,18455,18382,18311,18239,18169,18098,18029,17960,17891,17823,17756,17689,17622,17556,17491,17426,17361,17297,17233,17170,17108,17045,16984,16922,16862,16801,16741,16681,16622,16564,16505,16447,16390,16333,16276,16220,16164,16108,16053,15998,15944,15890,15836,15783,15730,15677,15625,15573,15522,15470,15419,15369,15319,15269,15219,15170,15121,15072,15024,14976,14928,14881,14834,14787,14741,14694,14648,14603,14557,14512,14468,14423,14379,14335,14291,14248,14205,14162,14119,14077,14034,13993,13951,13909,13868,13827,13787,13746,13706,13666,13626,13587,13548,13509,13470,13431,13393,13355,13317,13279,13242,13204,13167,13130,13094,13057,13021,12985,12949,12913,12878,12842,12807,12772,12738,12703,12669,12635,12601,12567,12533,12500,12467,12434,12401,12368,12336,12303,12271,12239,12207,12175,12144,12112,12081,12050,12019,11988,11958,11927,11897,11867,11837,11807,11778,11748,11719,11690,11660,11632,11603,11574,11546,11517,11489,11461,11433,11405,11377,11350,11322,11295,11268,11241,11214,11187,11161,11134,11108,11082,11055,11029,11004,10978,10952,10927,10901,10876,10851,10826,10801,10776,10751,10727,10702,10678,10653,10629,10605,10581,10557,10534,10510,10487,10463,10440,10417,10394,10371,10348,10325,10302,10280,10257,10235,10212,10190,10168,10146,10124,10102,10081,10059,10037,10016,9994,9973,9952,9931,9910,9889,9868,9847,9827,9806,9786,9765,9745,9725,9705,9684,9664,9645,9625,9605,9585,9566,9546,9527,9508,9488,9469,9450,9431,9412,9393,9375,9356,9337,9319,9300,9282,9263,9245,9227,9209,9191,9173,9155,9137,9119,9101,9084,9066,9049,9031,9014,8997,8979,8962,8945,8928,8911,8894,8877,8861,8844,8827,8811,8794,8778,8761,8745,8729,8712,8696,8680,8664,8648,8632,8616,8600,8585,8569,8553,8538,8522,8507,8491,8476,8461,8445,8430,8415,8400,8385,8370,8355,8340,8325,8311,8296,8281,8267,8252,8238,8223,8209,8194,8180,8166,8152,8138,8123,8109,8095,8081,8068,8054,8040,8026,8012,7999,7985,7971,7958,7944,7931,7918,7904,7891,7878,7864,7851,7838,7825,7812,7799,7786,7773,7760,7747,7735,7722,7709,7697,7684,7671,7659,7646,7634,7622,7609,7597,7585,7572,7560,7548,7536,7524,7512,7500,7488,7476,7464,7452,7440,7428,7416,7405,7393,7381,7370,7358,7347,7335,7324,7312,7301,7290,7278,7267,7256,7245,7233,7222,7211,7200,7189,7178,7167,7156,7145,7134,7123,7113,7102,7091,7080,7070,7059,7048,7038,7027,7017,7006,6996,6985,6975,6965,6954,6944,6934,6923,6913,6903,6893,6883,6873,6863,6853,6843,6833,6823,6813,6803,6793,6783,6773,6764,6754,6744,6734,6725,6715,6706,6696,6686,6677,6667,6658,6648,6639,6630,6620,6611,6602,6592,6583,6574,6565,6555,6546,6537,6528,6519,6510,6501,6492,6483,6474,6465,6456,6447,6438,6430,6421,6412,6403,6395,6386,6377,6368,6360,6351,6343,6334,6325,6317,6308,6300,6291,6283,6275,6266,6258,6250,6241,6233,6225,6216,6208,6200,6192,6184,6175,6167,6159,6151,6143,6135,6127,6119,6111,6103,6095,6087,6079,6071,6064,6056,6048,6040,6032,6025,6017,6009,6001,5994,5986,5979,5971,5963,5956,5948,5941,5933,5926,5918,5911,5903,5896,5888,5881,5874,5866,5859,5852,5844,5837,5830,5823,5815,5808,5801,5794,5787,5779,5772,5765,5758,5751,5744,5737,5730,5723,5716,5709,5702,5695,5688,5681,5674,5668,5661,5654,5647,5640,5634,5627,5620,5613,5607,5600,5593,5587,5580,5573,5567,5560,5553,5547,5540,5534,5527,5521,5514,5508,5501,5495,5488,5482,5476,5469,5463,5456,5450,5444,5437,5431,5425,5419,5412,5406,5400,5394,5387,5381,5375,5369,5363,5357,5351,5344,5338,5332,5326,5320,5314,5308,5302,5296,5290,5284,5278,5272,5266,5260,5255,5249,5243,5237,5231,5225,5219,5214,5208,5202,5196,5191,5185,5179,5173,5168,5162,5156,5151,5145,5139,5134,5128,5123,5117,5111,5106,5100,5095,5089,5084,5078,5073,5067,5062,5056,5051,5045,5040,5034,5029,5024,5018,5013,5008,5002,4997,4992,4986,4981,4976,4970,4965,4960,4955,4949,4944,4939,4934,4929,4923,4918,4913,4908,4903,4898,4893,4887,4882,4877,4872,4867,4862,4857,4852,4847,4842,4837,4832,4827,4822,4817,4812,4807,4802,4797,4792,4788,4783,4778,4773,4768,4763,4758,4754,4749,4744,4739,4734,4730,4725,4720,4715,4711,4706,4701,4696,4692,4687,4682,4678,4673,4668,4664,4659,4654,4650,4645,4641,4636,4631,4627,4622,4618,4613,4609,4604,4600,4595,4591,4586,4582,4577,4573,4568,4564,4559,4555,4551,4546,4542,4537,4533,4529,4524,4520,4515,4511,4507,4502,4498,4494,4489,4485,4481,4477,4472,4468,4464,4460,4455,4451,4447,4443,4438,4434,4430,4426,4422,4418,4413,4409,4405,4401,4397,4393,4389,4384,4380,4376,4372,4368,4364,4360,4356,4352,4348,4344,4340,4336,4332,4328,4324,4320,4316,4312,4308,4304,4300,4296,4292,4288,4284,4280,4276,4273,4269,4265,4261,4257,4253,4249,4245,4242,4238,4234,4230,4226,4223,4219,4215,4211,4207,4204,4200,4196,4192,4189,4185,4181,4177,4174,4170,4166,4163,4159,4155,4151,4148,4144,4140,4137,4133,4130,4126,4122,4119,4115,4111,4108,4104,4101,4097,4093,4090,4086,4083,4079,4076,4072,4069,4065,4062,4058,4054,4051,4047,4044,4040,4037,4034,4030,4027,4023,4020,4016,4013,4009,4006,4003,3999,3996,3992,3989,3986,3982,3979,3975,3972,3969,3965,3962,3959,3955,3952,3949,3945,3942,3939,3935,3932,3929,3925,3922,3919,3916,3912,3909,3906,3903,3899,3896,3893,3890,3886,3883,3880,3877,3874,3870,3867,3864,3861,3858,3854,3851,3848,3845,3842,3839,3835,3832,3829,3826,3823,3820,3817,3814,3811,3807,3804,3801,3798,3795,3792,3789,3786,3783,3780,3777,3774,3771,3768,3765,3762,3759,3756,3753,3750,3747,3744,3741,3738,3735,3732,3729,3726,3723,3720,3717,3714,3711,3708,3705,3702,3699,3696,3693,3690,3688,3685,3682,3679,3676,3673,3670,3667,3665,3662,3659,3656,3653,3650,3647,3645,3642,3639,3636,3633,3630,3628,3625,3622,3619,3616,3614,3611,3608,3605,3603,3600,3597,3594,3592,3589,3586,3583,3581,3578,3575,3572,3570,3567,3564,3561,3559,3556,3553,3551,3548,3545,3543,3540,3537,3535,3532,3529,3527,3524,3521,3519,3516,3513,3511,3508,3506,3503,3500,3498,3495,3492,3490,3487,3485,3482,3480,3477,3474,3472,3469,3467,3464,3462,3459,3456,3454,3451,3449,3446,3444,3441,3439,3436,3434,3431,3429,3426,3424,3421,3419,3416,3414,3411,3409,3406,3404,3401,3399,3396,3394,3391,3389,3386,3384,3382,3379,3377,3374,3372,3369,3367,3365,3362,3360,3357,3355,3353,3350,3348,3345,3343,3341,3338,3336,3333,3331,3329,3326,3324,3322,3319,3317,3315,3312,3310,3308,3305,3303,3301,3298,3296,3294,3291,3289,3287,3284,3282,3280,3278,3275,3273,3271,3268,3266,3264,3262,3259,3257,3255,3252,3250,3248,3246,3243,3241,3239,3237,3235,3232,3230,3228,3226,3223,3221,3219,3217,3215,3212,3210,3208,3206,3204,3201,3199,3197,3195,3193,3190,3188,3186,3184,3182,3180,3178,3175,3173,3171,3169,3167,3165,3163,3160,3158,3156,3154,3152,3150,3148,3146,3143,3141,3139,3137,3135,3133,3131,3129,3127,3125,3122,3120,3118,3116,3114,3112,3110,3108,3106,3104,3102,3100,3098,3096,3094,3092,3090,3087,3085,3083,3081,3079,3077,3075,3073,3071,3069,3067,3065,3063,3061,3059,3057,3055,3053,3051,3049,3047,3045,3043,3041,3039,3037,3035,3034,3032,3030,3028,3026,3024,3022,3020,3018,3016,3014,3012,3010,3008,3006,3004,3002,3001,2999,2997,2995,2993,2991,2989,2987,2985,2983,2981,2980,2978,2976,2974,2972,2970,2968,2966,2964,2963,2961,2959,2957,2955,2953,2951,2950,2948,2946,2944,2942,2940,2938,2937,2935,2933,2931,2929,2927,2926,2924,2922,2920,2918,2916,2915,2913,2911,2909,2907,2906,2904,2902,2900,2898,2897,2895,2893,2891,2890,2888,2886,2884,2882,2881,2879,2877,2875,2874,2872,2870,2868,2867,2865,2863,2861,2860,2858,2856,2854,2853,2851,2849,2847,2846,2844,2842,2840,2839,2837,2835,2834,2832,2830,2828,2827,2825,2823,2822,2820,2818,2817,2815,2813,2811,2810,2808,2806,2805,2803,2801,2800,2798,2796,2795,2793,2791,2790,2788,2786,2785,2783,2781,2780,2778,2777,2775,2773,2772,2770,2768,2767,2765,2763,2762,2760,2759,2757,2755,2754,2752,2750,2749,2747,2746,2744,2742,2741,2739,2738,2736,2734,2733,2731,2730,2728,2726,2725,2723,2722,2720,2719,2717,2715,2714,2712,2711,2709,2708,2706,2704,2703,2701,2700,2698,2697,2695,2694,2692,2690,2689,2687,2686,2684,2683,2681,2680,2678,2677,2675,2674,2672,2670,2669,2667,2666,2664,2663,2661,2660,2658,2657,2655,2654,2652,2651,2649,2648,2646,2645,2643,2642,2640,2639,2637,2636,2634,2633,2631,2630,2629,2627,2626,2624,2623,2621,2620,2618,2617,2615,2614,2612,2611,2610,2608,2607,2605,2604,2602,2601,2599,2598,2597,2595,2594,2592,2591,2589,2588,2586,2585,2584,2582,2581,2579,2578,2577,2575,2574,2572,2571,2569,2568,2567,2565,2564,2562,2561,2560,2558,2557,2555,2554,2553,2551,2550,2548,2547,2546,2544,2543,2542,2540,2539,2537,2536,2535,2533,2532,2531,2529,2528,2527,2525,2524,2522,2521,2520,2518,2517,2516,2514,2513,2512,2510,2509,2508,2506,2505,2504,2502,2501,2500,2498,2497,2496,2494,2493,2492,2490,2489,2488,2486,2485,2484,2482,2481,2480,2478,2477,2476,2474,2473,2472,2471,2469,2468,2467,2465,2464,2463,2461,2460,2459,2458,2456,2455,2454,2452,2451,2450,2449,2447,2446,2445,2444,2442,2441,2440,2438,2437,2436,2435,2433,2432,2431,2430,2428,2427,2426,2425,2423,2422,2421,2420,2418,2417,2416,2415,2413,2412,2411,2410,2408,2407,2406,2405,2403,2402,2401,2400,2398,2397,2396,2395,2394,2392,2391,2390,2389,2387,2386,2385,2384,2383,2381,2380,2379,2378,2377,2375,2374,2373,2372,2371,2369,2368,2367,2366,2365,2363,2362,2361,2360,2359,2357,2356,2355,2354,2353,2352,2350,2349,2348,2347,2346,2344,2343};
Uint16 dn = 0, dp = 0;

//---------------------------------------------------------------------------
// INT13, INT14, NMI, XINT1, XINT2 Default ISRs:
//
Uint16 Test = 0, Tmp = 0, Cmp2 = 0, Under = 0;



// 设备运行计时
interrupt void INT13_ISR(void)     // INT13 or CPU-Timer1
{
	static unsigned int counter = 0;
	run_time ++;
	counter ++;
	if(counter >= 16)
	{
		counter = 0;
	}
}

interrupt void INT14_ISR(void)     // CPU-Timer2
{
  // Insert ISR Code here

  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;
}

interrupt void NMI_ISR(void)       // Non-maskable interrupt
{
  // Insert ISR Code here

  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;
}
// AD采样-电压、电流,读取-PID
interrupt void  XINT1_ISR(void)
{
	int i;
	unsigned int data;

	PieCtrl.PIEACK.bit.ACK1 = 1;

	for(i=0; i<2; i++)
	{
		data = *((unsigned int *)0x4407);
		switch(data & 0xF000)
		{
		case 0x8000:	// 通道a0(电压)
		case 0x9000:	// 通道a1(电流)
			if((data & 0xF000) == 0x8000)
			{
				v_sample = (int)(((long)v_sample*15 + (int)(data<<4))>>4);	// 数字低通滤波
				if((status&0x0001) == 1)
					continue;				
			}
			else
			{
				i_sample = (int)(((long)i_sample*15 + (int)(data<<4))>>4);
				if((status&0x0001) == 0)
					continue;
			}

			// 执行控制算法
			if((status&0x0001) == 0)
			{
				e0 = v_ref - v_sample;
				a1 = v_a1;
				a2 = v_a2;
				a3 = v_a3;
				i_ref = i_sample;
			}
			else
			{
				e0 = i_ref - i_sample;
				a1 = i_a1;
				a2 = i_a2;
				a3 = i_a3;
				v_ref = v_sample;
			}

			if(running_status == 2)	// 数字PID
			{
				phase_shifting = u1 + a1 * e0 + a3 * e2 - a2 * e1;
			}
			else if(running_status == 1)
			{
				if(e0 > 0)
					phase_shifting += 0x0100;
				else if(e0 < 0)
					phase_shifting -= 0x0100;
			}
			else
				phase_shifting = lbound;

// set low or high boundary
			if(phase_shifting < lbound)
				phase_shifting = lbound;
			else if(phase_shifting > hbound)
				phase_shifting = hbound;
// for next
			u1 = phase_shifting;
			e2 = e1;
			e1 = e0;
			break;

		case 0xA000:	// 通道b0
			break;

		case 0xB000:	// 通道b1
			break;

		case 0xC000:	// 通道c0
			break;

		case 0xD000:	// 通道c1
			break;
		}
	}
}     

interrupt void  XINT2_ISR(void)
{
  // Insert ISR Code here

  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;
}

//---------------------------------------------------------------------------
// DATALOG, RTOSINT, EMUINT, RTOS Default ISRs:
//
interrupt void DATALOG_ISR(void)   // Datalogging interrupt
{
  // Insert ISR Code here
 
  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;

}

interrupt void RTOSINT_ISR(void)   // RTOS interrupt
{
  // Insert ISR Code here

  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;
}

interrupt void EMUINT_ISR(void)    // Emulation interrupt
{
  // Insert ISR Code here

  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;
}

//---------------------------------------------------------------------------
// ILLEGAL Instruction Trap ISR:
//
interrupt void ILLEGAL_ISR(void)   // Illegal operation TRAP
{
  // Insert ISR Code here
  asm("          ESTOP0");
  for(;;);

  // Uncomment this line after adding ISR Code 
  // return;

}

//---------------------------------------------------------------------------
// USER Traps Default ISRs:
//
interrupt void USER0_ISR(void)     // User Defined trap 0
{
 // Insert ISR Code here
 
  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;
}

interrupt void USER1_ISR(void)     // User Defined trap 1
{
  // Insert ISR Code here

  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;
}

interrupt void USER2_ISR(void)     // User Defined trap 2
{
  // Insert ISR Code here

  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;

}

interrupt void USER3_ISR(void)     // User Defined trap 3
{
  // Insert ISR Code here

  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;

}

interrupt void USER4_ISR(void)     // User Defined trap 4
{
  // Insert ISR Code here

  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;
}

interrupt void USER5_ISR(void)     // User Defined trap 5
{
  // Insert ISR Code here

  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;
}

interrupt void USER6_ISR(void)     // User Defined trap 6
{
  // Insert ISR Code here

  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;
}

interrupt void USER7_ISR(void)     // User Defined trap 7
{
  // Insert ISR Code here

  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;

}

interrupt void USER8_ISR(void)     // User Defined trap 8
{
  // Insert ISR Code here

  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;
}

interrupt void USER9_ISR(void)     // User Defined trap 9
{
  // Insert ISR Code here

  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;

}

interrupt void USER10_ISR(void)    // User Defined trap 10
{
  // Insert ISR Code here

  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;

}

interrupt void USER11_ISR(void)    // User Defined trap 11
{
  // Insert ISR Code here

  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;

}

//---------------------------------------------------------------------------
// ADC Default ISR: 
//
interrupt void  ADCINT_ISR(void)     // ADC
{
	PieCtrl.PIEACK.bit.ACK1 = 1;
	AdcRegs.ADC_ST_FLAG.bit.INT_SEQ1_CLR=1;
}

//---------------------------------------------------------------------------
// CPU Timer 0 Default ISR: 
// 启动AD采样
interrupt void  TINT0_ISR(void)      // CPU-Timer 0
{
	PieCtrl.PIEACK.bit.ACK1 = 1;
/*	GpioDataRegs.GPFDAT.bit.GPIOF13 = 0;
	asm(" RPT #8 || NOP");
	GpioDataRegs.GPFDAT.bit.GPIOF13 = 1;
*/
 
}

//---------------------------------------------------------------------------
// Watchdog Default ISR: 
//
interrupt void  WAKEINT_ISR(void)    // WD
{
  // Insert ISR Code here

  // To recieve more interrupts from this PIE group, acknowledge this interrupt 
  // PieCtrl.PIEACK.all = PIEACK_GROUP1; 
  
  // Next two lines for debug only - remove after inserting
  // ISR Code
   asm ("      ESTOP0");
   for(;;);

  // Uncomment this line after adding ISR Code 
  // return;

⌨️ 快捷键说明

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