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

📄 2410test.c

📁 步进电机控制程序
💻 C
字号:
//====================================================================
// File Name : 2410test.c
// Function  : S3C2410 Test Main Menu
// Program   : Shin, On Pil (SOP)
// Date      : June 13, 2003
// Version   : 0.0
// History
//   0.0 : Programming start (February 20,2002) -> SOP
//   1.0 (20020530) : First release for customer
//   1.1 (20020801) : Strata NOR Flash Added and etc. -> SOP
//   1.2 (20020930) : Added IIS Slave mode Test Menu. -> SOP
//       (20021208) : IIS Record & Play Test
//       (20030324) : Added K9S1208 Erase -> SOP
//       (20030331) : Added Test_Cache -> SOP
//       (20030613) : SOP
//====================================================================

#include <stdlib.h>
#include <string.h>

//Shin, On Pil
#include "def.h"
#include "option.h"
#include "2410addr.h"
#include "2410lib.h"
#include "2410slib.h"
#include "Timer.h"
#include "Motor.h"
#include "Uart0.h"
#include "mmu.h"
#include "PowerOff.h"
#include "Lcd.h"

void Isr_Init(void);
void HaltUndef(void);
void HaltSwi(void);
void HaltPabort(void);
void HaltDabort(void);

//===================================================================
void Main(void)
{
    MMU_Init();
    #if ADS10   
    __rt_lib_init();                //for ADS 1.0
    #endif
    ChangeClockDivider(1,1);          // 1:2:4    
    ChangeMPllValue(0x2a,0x1,0x0);    // FCLK=200MHz   
    Port_Init();
    Isr_Init();
    Uart_Init(0,9600);   
    Uart_Select(0);
    Motor_Init();  
    Timer_Init();
    //Check whether or not the POWER_OFF wake-up.
    //Delay(0);	//calibrate Delay() 
    //Check_PowerOffWakeUp();  //It's needed for power-off STOP mode test.
    rIISPSR=(2<<5)|(2<<0); //IIS_LRCK=44.1Khz @384fs,PCLK=50Mhz.
    rGPHCON = rGPHCON & ~(0xf<<18)|(0x5<<18);   //CLKOUT 0,1=OUTPUT to reduce the power consumption.
   // Test_Lcd_Tft_8Bit_240320_On();
    while(1)
        {   
         Motor_Control_Proc();
         Uart_Control_Proc();
        }
}

//===================================================================
void Isr_Init(void)
{
    pISR_UNDEF  = (unsigned)HaltUndef;
    pISR_SWI    = (unsigned)HaltSwi;
    pISR_PABORT = (unsigned)HaltPabort;
    pISR_DABORT = (unsigned)HaltDabort;
    
    rINTMOD     = 0x0;                       //All=IRQ mode   
    //rINTMSK     = ~(BIT_TIMER0);      
    //rINTSUBMSK  = ~(BIT_SUB_RXD0+BIT_SUB_TXD0+BIT_SUB_ERR0);  
   // rINTMOD     = 0x0;                     //All=IRQ mode
   //  rINTCON=0x5;                           //Non-vectored,IRQ enable,FIQ disable    
   // rINTMSK     = BIT_ALLMSK;              //All interrupt is masked.
   // rINTSUBMSK  = BIT_SUB_ALLMSK;          //All sub-interrupt is masked. <- April 01, 2002 SOP             
    
    pISR_UART0 =(unsigned)Uart0_RxIntOrErr;            //pISR_FIQ,pISR_IRQ must be initialized
}

//===================================================================
void HaltUndef(void)
{
    //Uart_Printf("Undefined instruction exception.\n");
    while(1);
}

//===================================================================
void HaltSwi(void)
{
    //Uart_Printf("SWI exception.\n");
    while(1);
}

//===================================================================
void HaltPabort(void)
{
    //Uart_Printf("Pabort exception.\n");
    while(1);
}

//===================================================================
void HaltDabort(void)
{
    //Uart_Printf("Dabort exception.\n");
    while(1);
}

⌨️ 快捷键说明

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