本文整理汇总了C++中InitSysCtrl函数的典型用法代码示例。如果您正苦于以下问题:C++ InitSysCtrl函数的具体用法?C++ InitSysCtrl怎么用?C++ InitSysCtrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InitSysCtrl函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: init
void init(void) {
InitSysCtrl();
EALLOW;
//TODO Add code to configure GPADIR through IPC
GPIO_WritePin(31, 1);
GPIO_WritePin(34, 1);
InitSysCtrl();
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the F2837xD_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in F2837xD_DefaultIsr.c.
// This function is found in F2837xD_PieVect.c.
InitPieVectTable();
// Enable global Interrupts and higher priority real-time debug events:
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
}
开发者ID:FrauBluher,项目名称:ShR2,代码行数:35,代码来源:main.c
示例2: main
void main(void)
{
InitSysCtrl();
InitXintf();
InitXintf16Gpio();
ADInit();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.TINT0 = &ISRTimer0;
EDIS; // This is needed to disable write to EALLOW protected registers
InitCpuTimers(); // For this example, only initialize the Cpu Timers
ConfigCpuTimer(&CpuTimer0, 100, 987); //在定时器内进行采样,采样率1.5KHz
IER |= M_INT1;
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
EINT;
ERTM;
/*EALLOW;
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0; // GPIO0 = GPIO0
GpioCtrlRegs.GPADIR.bit.GPIO0 = 1;
EDIS;
GpioDataRegs.GPADAT.bit.GPIO0 = 0;*/
SET_ADRST;
DELAY_US(100000);
CLEAR_ADRST;
StartCpuTimer0();
while(1);
}
开发者ID:yukunli,项目名称:03_Hardware_Design,代码行数:35,代码来源:main.c
示例3: main
void main(void)
{
//
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the F2837xS_SysCtrl.c file.
//
InitSysCtrl();
//
// Step 2. Initialize GPIO:
// This example function is found in the F2837xS_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
//
InitGpio();
//
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
//
DINT;
//
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the F2837xS_PieCtrl.c file.
//
InitPieCtrl();
//
// Disable CPU interrupts and clear all CPU interrupt flags:
//
IER = 0x0000;
IFR = 0x0000;
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in F2837xS_DefaultIsr.c.
// This function is found in F2837xS_PieVect.c.
//
InitPieVectTable();
//
// Step 4. Call function to issue the SCC reset. If the SCC reset has
// already occurred, the program will stop here.
//
if(CpuSysRegs.RESC.bit.SCCRESETn != 1)
{
IssueSCCReset(CPUTIMER0);
}
else
{
ESTOP0;
for(;;);
}
}
开发者ID:AdrianoRuseler,项目名称:LAUNCHXL-F28377S,代码行数:60,代码来源:dcsm_scc_reset_cpu01.c
示例4: cpuInit
void cpuInit(void){
InitSysCtrl();
/* Disable CPU interrupts */
DINT;
/* Initialize the PIE control registers to their default state.
* The default state is all PIE interrupts disabled and flags
* are cleared.
* This function is found in the DSP2833x_PieCtrl.c file. */
InitPieCtrl();
/* Disable CPU interrupts and clear all CPU interrupt flags: */
IER = 0x0000;
IFR = 0x0000;
/* Initialize the PIE vector table with pointers to the shell Interrupt Service Routines (ISR). */
InitPieVectTable();
/* Timer interrupt mapping */
EALLOW; /* This is needed to write to EALLOW protected registers */
PieVectTable.TINT0 = &cpu_timer0_isr;
EDIS; /* This is needed to disable write to EALLOW protected registers */
InitCpuTimers();
/* Write the LPM code value */
EALLOW;
if (SysCtrlRegs.PLLSTS.bit.MCLKSTS != 1){ /* Only enter Idle mode when PLL is not in limp mode. */
SysCtrlRegs.LPMCR0.bit.LPM = 0x0000; /* LPM mode = Idle - can be woken by timer interrupt */
}
/* Enable interrupts */
EDIS;
}
开发者ID:chrispbarlow,项目名称:can_filtering_hardware,代码行数:35,代码来源:TT_Main.c
示例5: main
void main(void)
{
//--- CPU Initialization
InitSysCtrl(); // Initialize the CPU
DINT;
InitPieCtrl(); // Initialize and enable the PIE
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
// median() test
memcpy_fast(x, y, N<<1); // Start with same data
z = 0.0;
asm(" NOP");
z = median_SP_RV(x, N);
asm(" NOP");
// median_noreorder() test
memcpy_fast(x, y, N<<1); // Start with same data
z = 0.0;
asm(" NOP");
z = median_noreorder_SP_RV(x, N);
asm(" NOP");
//--- Main Loop
while(1) // Dummy loop. Wait for an interrupt.
{
asm(" NOP");
}
} // end of main()
开发者ID:microdu,项目名称:Energy_Pack_CODE,代码行数:34,代码来源:Test_FPU_Median.c
示例6: main
void main(void)
{
Uint16 i = 0x55;
// Step 1. Initialize System Control:
InitSysCtrl();
/*// Step 2. Copy programs from Flash to RAM for accurate timing
//!! in this mode, use F28335.cmd instead of F28335_RAM_lnk.cmd
memcpy(&RamfuncsRunStart,&RamfuncsLoadStart,&RamfuncsLoadEnd - &RamfuncsLoadStart);*/
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
// Step 4. Initial XZONE
InitXintf();
// Step 5. IDLE loop. Just sit and loop forever (optional):
for(;;)
{
DELAY_US(DELAY);
LED = i;
i = ~i;
}
}
开发者ID:ClarePhang,项目名称:Base_TMS320F28335,代码行数:26,代码来源:LED_Flash.c
示例7: main
void main(void)
{
//--- CPU Initialization
InitSysCtrl(); // Initialize the CPU
DINT;
InitPieCtrl(); // Initialize and enable the PIE
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
// Complex multiply test
x.dat[0]=2.0; // x_re
x.dat[1]=3.0; // x_im
w.dat[0]=4.0; // w_re
w.dat[1]=5.0; // w_im
y.dat[0]=0;
y.dat[1]=0;
// Result is y = -7 + j*22
asm(" NOP");
y = mpy_SP_CSxCS(w,x); // complex multiply
asm(" NOP");
//--- Main Loop
while(1) // Dummy loop. Wait for an interrupt.
{
asm(" NOP");
}
} // end of main()
开发者ID:microdu,项目名称:Energy_Pack_CODE,代码行数:32,代码来源:Test_FPU_ComplexMultiply.c
示例8: main
void main(void)
{
//------- INTERNAL INIT------------//
InitSysCtrl();
DINT; //Disable CPU interrupts
InitPieCtrl();
IER = 0x0000; //Disable CPU interrupts and clear all CPU interrupt flags:
IFR = 0x0000;
InitPieVectTable();
//------- END INTERNAL INIT--------//
InitPWM3();
InitDACA();
InitDACC();
InitADC();
//PLL 1PHASE//
SPLL_1ph_F_init(50,((float)(1.0/200000.0F)), &spll1);
SPLL_1ph_F_notch_coeff_update(((float)(1.0/50000.0F)), (float)(2*PI*50*2),(float)0.00001,(float)0.1, &spll1);
while(1)
{
}
}
开发者ID:macgeorge,项目名称:TI-example-codes,代码行数:25,代码来源:main.c
示例9: StartUp
void StartUp()
{
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (unsigned long)&RamfuncsLoadSize);
InitSysCtrl();
InitGpio();
DINT;
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in DSP2803x_DefaultIsr.c.
// This function is found in DSP2803x_PieVect.c.
InitPieVectTable();
//Initialize Flash
//InitFlash();
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
EALLOW;
Flash_CPUScaleFactor = SCALE_FACTOR;
Flash_CallbackPtr = 0;
EDIS;
}
开发者ID:BuckeyeCurrent,项目名称:Driver_Display_RW2.x,代码行数:34,代码来源:main.c
示例10: InitHW
void InitHW(void)
{
/* Step 1. Initialize System Control: */
/* PLL, WatchDog, enable Peripheral Clocks */
InitSysCtrl();
// Step 2. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the DSP2833x_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in DSP2833x_DefaultIsr.c.
// This function is found in DSP2833x_PieVect.c.
InitPieVectTable();
// Interrupts that are used in this example are re-mapped to
// ISR functions found within this file.
EALLOW; // This is needed to write to EALLOW protected registers
// PieVectTable.TINT0 = &cpu_timer0_isr;
// PieVectTable.XINT13 = &cpu_timer1_isr;
PieVectTable.TINT2 = &os_time_tick;
EDIS; // This is needed to disable write to EALLOW protected registers
// Step 3. Initialize the Device Peripheral. This function can be
// found in DSP2833x_CpuTimers.c
}
开发者ID:janiex,项目名称:OSEK_GENERATOR,代码行数:34,代码来源:InitHW.c
示例11: CAN_init
void CAN_init(){
struct ECAN_REGS ECanaShadow;
//CAN_INFO_ARRAY[ID].upon_sent_isr = send_isr;
//CAN_INFO_ARRAY[ID].upon_receive_isr = receive_isr;
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This function is found in the F2806x_SysCtrl.c file.
// Should be commented out in regular usage. For normal usage initializing the system should be done elsewhere not in the CAN code.
// For testing purposes this is uncommented to initialize the system.
InitSysCtrl();
// Step 2. Initalize GPIO:
// Configure CAN pins using GPIO regs here
// This function is found in F2806x_ECan.c
InitECanGpio();
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
EALLOW;
//Direct ECANA0 interrupts to the proper isr
PieVectTable.ECAN0INTA = &ecan_isr;
EDIS;
// Enable the PIE Vector Table
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
// Step 4. Initialize CAN module
InitECana();
EALLOW;
//Allow all mailboxes to send interrupts
ECanaRegs.CANMIM.all = 0xFFFFFFFF;
//Disable all other system interrupts (not recommended)
//Only enable level 0 interrupts
//BY DEFAULT using level 0 CAN interrupts
ECanaRegs.CANGIM.all = 0x00000001;
// EALLOW;
ECanaShadow.CANMC.all = ECanaRegs.CANMC.all;
ECanaShadow.CANMC.bit.STM = 1; // Configure CAN for self-test mode
ECanaRegs.CANMC.all = ECanaShadow.CANMC.all;
//EDIS;
EDIS;
//CAN interrupts are part of IER 9
IER |= M_INT9;
//Enable ECAN interrupt 0 in PIE
PieCtrlRegs.PIEIER9.bit.INTx5 = 1;
// Enable global Interrupts and higher priority real-time debug events:
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
}
开发者ID:drechtmann3,项目名称:sr1_software-master,代码行数:59,代码来源:can.c
示例12: CPUinit
void CPUinit(){
InitSysCtrl();
EALLOW;
SysCtrlRegs.PLLSTS.bit.DIVSEL = 0;
SysCtrlRegs.PLLCR.bit.DIV = 0xA;
SysCtrlRegs.PLLSTS.bit.DIVSEL = 2;
}
开发者ID:kbradley91,项目名称:Lab6,代码行数:8,代码来源:part2.c
示例13: main
void main()
{
unsigned long i;
InitSysCtrl();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
/* Signal Generator module initialisation */
sgen.offset=0;
sgen.gain=0x7fff; /* gain=1 in Q15 */
sgen.freq=5369; /* freq = (Required Freq/Max Freq)*2^15 */
/* = (50/305.17)*2^15 = 5369 */
sgen.step_max=1000; /* Max Freq= (step_max * sampling freq)/65536 */
/* Max Freq = (1000*20k)/65536 = 305.17 */
sgen.phase=0x4000; /* Phase= (required Phase)/180 in Q15 format */
/* = (+90/180) in Q15 = 4000h */
for(i=0; i<SIGNAL_LENGTH; i++)
{
ipcb1[i]=0;
ipcb2[i]=0;
ipcb3[i]=0;
ipcb4[i]=0;
ipcb5[i]=0;
ipcb6[i]=0;
}
/*---------------------------------------------------------------------------
Nothing running in the background at present
----------------------------------------------------------------------------*/
for(i=0; i<SIGNAL_LENGTH; i++)
{
sgen.calc(&sgen);
x11=sgen.out11;
x12=sgen.out12;
x13=sgen.out13;
x21=sgen.out21;
x22=sgen.out22;
x23=sgen.out23;
ipcb1[i]=x11;
ipcb2[i]=x12;
ipcb3[i]=x13;
ipcb4[i]=x21;
ipcb5[i]=x22;
ipcb6[i]=x23;
}
for(;;);
} /* End: main() */
开发者ID:equinoxorg,项目名称:Micro-Hydro-ELC,代码行数:58,代码来源:sgenti3d.c
示例14: main
void main(void)
{
//--- CPU Initialization
InitSysCtrl(); // Initialize the CPU (FILE: SysCtrl.c)
InitGpio(); // Initialize the shared GPIO pins (FILE: Gpio.c)
InitPieCtrl(); // Initialize and enable the PIE (FILE: PieCtrl.c)
InitWatchdog(); // Initialize the Watchdog Timer (FILE: WatchDog.c)
//--- Peripheral Initialization
InitAdc(); // Initialize the ADC (FILE: Adc.c)
InitEPwm(); // Initialize the EPwm (FILE: EPwm.c)
int d;
for (d = 0; d < SIN_DEFINITION; d++) {
sinValues[d] = (int)(fabs(sin(d * 180.f / SIN_DEFINITION * 2 * PI / 360)) * SIN_AMPLITUDE) + LOWER_HYSTERESIS_BAND;
}
// Variable Initialization
asm (" ESTOP0"); // Emulator Halt instruction
int i = 0;
//--- Enable global interrupts
// Enable global interrupts and realtime debug
asm("DBGM");
asm(" CLRC INTM");
//--- Main Loop
while(D) // endless loop - wait for an interrupt
{
i ++;
if (i == 600) {
EPwm1Regs.AQSFRC.bit.ACTSFA = 1; // What to do when One-Time Software Forced Event is invoked
// 00 Does nothing (action disabled)
// 01 Clear (low)
// 10 Set (high)
// 11 Toggle
EPwm1Regs.AQSFRC.bit.OTSFA = 1; // Invoke One-Time Software Forced Event on Output A
EPwm1Regs.AQSFRC.bit.ACTSFB = 2; // What to do when One-Time Software Forced Event is invoked
// 00 Does nothing (action disabled)
// 01 Clear (low)
// 10 Set (high)
// 11 Toggle
EPwm1Regs.AQSFRC.bit.OTSFB = 1; // Invoke One-Time Software Forced Event on Output A
i = 0;
}
}
//--- Main Loop
while(1) // endless loop - wait for an interrupt
{
asm(" NOP");
}
} //end of main()
开发者ID:meneses,项目名称:piccolo,代码行数:57,代码来源:Main.c
示例15: main
//
// Main
//
void main(void)
{
//
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the F2837xS_SysCtrl.c file.
//
InitSysCtrl();
//
// Step 2. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
//
DINT;
//
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the F2837xS_PieCtrl.c file.
//
InitPieCtrl();
//
// Disable CPU interrupts and clear all CPU interrupt flags:
//
IER = 0x0000;
IFR = 0x0000;
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in F2837xS_DefaultIsr.c.
// This function is found in F2837xS_PieVect.c.
//
InitPieVectTable();
//
// Step 3. Configure the CLA memory spaces first followed by
// the CLA task vectors
//
CLA_configClaMemory();
CLA_initCpu1Cla1();
//
// Step 4. Enable global Interrupts and higher priority real-time debug events:
//
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
//
// Step 5. Run the test
//
CLA_runTest();
}
开发者ID:AdrianoRuseler,项目名称:LAUNCHXL-F28377S,代码行数:60,代码来源:cla_atan_cpu01.c
示例16: main
void main(void)
{
InitSysCtrl();
// Copy time critical code and Flash setup code to RAM
// This includes the following ISR functions: epwm1_timer_isr(), epwm2_timer_isr()
// epwm3_timer_isr and and InitFlash();
// The RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart
// symbols are created by the linker. Refer to the F28335.cmd file.
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the DSP2833x_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in DSP2833x_DefaultIsr.c.
// This function is found in DSP2833x_PieVect.c.
InitPieVectTable();
// Interrupts that are used in this example are re-mapped to
// ISR functions found within this file.
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.SEQ1INT = &PWM_AD_isr;
PieVectTable.ECAN0INTA = &Skiip4_CAN_isr;
EDIS; // This is needed to disable write to EALLOW protected registers
InitFlash();
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
MemCopy(&IQmathLoadStart, &IQmathLoadEnd, &IQmathRunStart);
//ECan-A模块初始化
InitECan();
InitECan1();
InitGpio(); // Skipped for this example
InitAdc(); // Initialize necessary ADC module, directly for SVPWM.
InitEPwm();
IER |= M_INT1;
// Enable SEQ1_INT which is connected to PIE1.1:
IER |= M_INT9;
// Enable eCAN0-A INT which is connected to PIE9.5:
EINT;
} // end of main()
开发者ID:nuaaabb,项目名称:nuaabb,代码行数:57,代码来源:Main.c
示例17: main
void main(void)
{
// Step 1. Initialize System Control registers, PLL, WatchDog,
// peripheral Clocks to default state:
// This function is found in the DSP281x_SysCtrl.c file.
InitSysCtrl();
// Step 2. Initalize GPIO:
// This example function is found in the DSP281x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
// InitGpio(); // Skipped for this example
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
// Initialize PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the DSP281x_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in DSP281x_DefaultIsr.c.
// This function is found in DSP281x_PieVect.c.
InitPieVectTable();
// Step 4. Initialize all the Device Peripherals:
// This function is found in DSP281x_InitPeripherals.c
// InitPeripherals(); // Not required for this example
// Step 5. User specific code
// Tests #1, #2, #3
Gpio_PortA();
// Test #4
Gpio_PortB();
// Test #5
Gpio_PortF();
program_stop();
// Step 6. IDLE loop. Just sit and loop forever (optional):
// for(;;);
}
开发者ID:shuw,项目名称:marconi,代码行数:56,代码来源:Example_281xGpioLoopback.c
示例18: main
void main(void)
{
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP280x_SysCtrl.c file.
InitSysCtrl();
// Copy time critical code and Flash setup code to RAM
// The RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart
// symbols are created by the linker. Refer to the linker files.
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
// Step 2. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
// Initialize PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the DSP280x_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in DSP280x_DefaultIsr.c.
// This function is found in DSP280x_PieVect.c.
InitPieVectTable();
// Step 3. Initialize the Device Peripherals:
PMBusMaster_Init(I2C_SLAVE_ADDR, CLK_PRESCALE);
EINT;
// Application loop
while(1)
{
//reads
pass_fail = PMBusMaster(STATUS_TEMPERATURE, 1, 0, Temp); //read byte
pass_fail = PMBusMaster(OPERATION, 1, 0, Oprn); //r/w byte (read)
pass_fail = PMBusMaster(STATUS_WORD, 1, 0, Stat); //read word
pass_fail = PMBusMaster(VOUT_COMMAND, 1, 0, VCmd); //r/w word (read)
//writes
pass_fail = PMBusMaster(STORE_DEFAULT_CODE, 0, 0xAA, 0); //write byte
pass_fail = PMBusMaster(OPERATION, 0, 0xBB, 0); //r/w byte (write)
pass_fail = PMBusMaster(VOUT_COMMAND, 0, 0xCCDD, 0); //r/w word (write)
Status = (Stat[1] << 8) | Stat[0]; //unpacking the two data bytes into one word
Vout_Command = (VCmd[1] << 8) | VCmd[0]; //the lowest order byte is received first
}
} // end of main
开发者ID:microdu,项目名称:Energy_Pack_CODE,代码行数:56,代码来源:master.c
示例19: main
void main(void)
{
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP2803x_SysCtrl.c file.
InitSysCtrl();
// Step 2. Initialize GPIO:
// This example function is found in the DSP2803x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
// InitGpio(); Skipped for this example
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
// Initialize PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the DSP2803x_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in DSP2803x_DefaultIsr.c.
// This function is found in DSP2803x_PieVect.c.
InitPieVectTable();
// Step 4. Initialize all the Device Peripherals:
// Not required for this example
// Step 5. User specific code:
#if EXAMPLE1
// This example is a basic pinout
Gpio_setup1();
#endif // - EXAMPLE1
#if EXAMPLE2
// This example is a communications pinout
Gpio_setup2();
#endif
}
开发者ID:pkahlert,项目名称:EPE-MES,代码行数:54,代码来源:Example_2803xGpioSetup.c
示例20: main
void main(void)
{
InitSysCtrl();
InitSpiaGpio();
Gpio_select();
/*
EALLOW;
SysCtrlRegs.WDCR = 0x00AF; // re-enable the watchdog
EDIS;
*/
DINT;
IER = 0x0000;
IFR = 0x0000;
InitPieCtrl();
InitPieVectTable();
InitAdc();
spi_fifo_init();
Setup_ePWM(); // ePWM
Setup_ADC(); // ADC setup
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.SPIRXINTA = &spiRxFifoIsr;
PieVectTable.SPITXINTA = &spiTxFifoIsr;
PieVectTable.SEQ1INT = &adc1_isr;
PieVectTable.EPWM1_INT = &ePWM1A_compare_isr;
EDIS; // This is needed to disable write to EALLOW protected registers
PieCtrlRegs.PIECTRL.bit.ENPIE = 1; // Enable the PIE block
PieCtrlRegs.PIEIER6.bit.INTx1 = 1; // Enable PIE Group 6, INT 1
PieCtrlRegs.PIEIER6.bit.INTx2 = 1; // Enable PIE Group 6, INT 2
PieCtrlRegs.PIEIER1.bit.INTx1 = 1; // adc1 (seq1 - pwm)
PieCtrlRegs.PIEIER3.bit.INTx1 = 1; // epwm1
IER |= 25; // Enable CPU INT6
EINT; // Enable Global Interrupts
ERTM;
while (1)
{
if (AdcRegs.ADCST.bit.INT_SEQ1 == 1) // ADC seq1 interrupt for pwm (at prd)
{
flag1 = 1;
AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;
}
if (EPwm1Regs.ETFLG.bit.INT == 1) // epwm interrupt for pwm of second converter (at prd)
{
flag2 = 1;
EPwm1Regs.ETCLR.bit.INT = 1;
}
}
}
开发者ID:akgemci,项目名称:dms_dsp,代码行数:52,代码来源:spikodd.c
注:本文中的InitSysCtrl函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论