示例#1
0
/*  
** Application loop
*/  
void main(void)
{   
    eWakeReason ResetType;
    
    /* Initialize this PIC */    
    ResetType = PIC_Init();
    
    switch (ResetType)
    {
        case ePOR:              /* Power on reset, hello there */
            break;
        case eDSWDTO:           /* DSWDT timeout wake from deep sleep */
            LATBbits.LATB2 ^= 1; /* toggle RB2 on each timeout wake from deep sleep */
            break;
        case eDSWINT0:          /* DSINT0 wake from deep sleep */  
            LATBbits.LATB3 ^= 1; /* toggle RB3 on each INT0 wake from deep sleep */
            break;
        case eDSPOR:            /* MCLR wake from deep sleep */
            break;
        case eWDTO:             /* WDT reset, never in deep sleep */
            break;
        default:                /*  */
            break;
    };
    
    /*
     * Warning: Simulator does not simulate deep sleep very well
     */
    /* enter deep sleep code */
    INTCON  &= ~0xF8;             /* Disable all interrupt sources */
    INTCON3 &= ~0x38;
    PIE1 = 0;
    PIE2 = 0;
    PIE3 = 0;
    PIE4 = 0;
    PIE5 = 0;

    TRISBbits.TRISB0 = 1;   /* Make RB0/INT0 an input */
    ANCON1bits.PCFG8 = 1;   /* Make RB0/INT0 a digital input */
    OSCCONbits.IDLEN = 0;
    WDTCONbits.REGSLP = 0;
    INTCON2bits.INTEDG0 = 0; /* Select HIGH to LOW edge for interrupt */
    INTCONbits.INT0IF = 0;  /* Clear the INT0 reauest flag */
    INTCONbits.INT0IE = 1;  /* Enable an INT0 assert to wake from sleep */
    DSCONHbits.DSEN = 1;
    Nop();
    Sleep();
    
    /*
     * If we get to deep sleep the only way out
     * is through the reset vector.
     * 
     * When we do not get to deep sleep we toggle RB1 fast and hang
     * until the user causes a reset.
     */
    for(;;)
    {
        LATBbits.LATB1 ^= 1; /* Toggle RB1 and hang to show we failed to enter deep sleep */
    }
}   
void main(void)
{
    clock_int_48MHz();

    PIC_Init();                     // Configurações gerais do PIC
   
    OS_Init();
    TRISB=0b00000000;
    TRISA=0b00000000;

    OS_Task_Create(1,Task_1);       // Criando uma tarefa,  prioridade 1
    OS_Task_Create(2,Task_2);       // Criando uma tarefa,  prioridade 2
    OS_Task_Create(3,Task_3);       // Criando uma tarefa,  prioridade 3
    //OS_Task_Create(4,Task_4);       // Criando uma tarefa,  prioridade 4

    OS_EI();                        // Habilita interrupcoes
    OS_Run();                       // Executa o RTOS
}
示例#3
0
文件: mpu401.c 项目: LasDesu/HardMPU
/* HardMPU: Initialisation */
void MPU401_Init()
{
	/* Initalise PIC code */
	PIC_Init();

	/* Initialise MIDI handler */
        MIDI_Init(CONFIG_SYSEXDELAY,CONFIG_FAKEALLNOTESOFF);
	if (!MIDI_Available()) return;

	mpu.queue_used=0;
	mpu.queue_pos=0;
	mpu.mode=M_UART;

        mpu.intelligent=true; /* Default is on */
	if (!mpu.intelligent) return;

        /* SOFTMPU: Moved IRQ 9 handler init to asm */
	MPU401_Reset();
}
示例#4
0
void main(void)
{
    /*
     * Power On Reset initialization
     */
    PIC_Init();
    LCD_Init();
    
    /* Display application and version */
    ShowVersion();
    /* Show what is in the character generator RAM */
    LCD_SetDDRamAddr(LINE_TWO);
    LCD_WriteConstString("\010\011\012\013\014\015\016\017"); /* octal byte constants in a string */
    LCD_WriteConstString(" 18JUL21");
    /*
     * Main application loop
     */
    for(;;)
    {
        
    }
}
示例#5
0
void vDos_Init(void)
	{
	hideWinTill = GetTickCount()+2500;												// Auto hidden till first keyboard check, parachute at 2.5 secs

	LOG_MSG("vDos version: %s", vDosVersion);

#ifndef WITHIRQ1
	// Wil have been called earlier in starup if WITHIRQ1 is defined
	vDos_LoadConfig();
#endif

	GUI_StartUp();
	IO_Init();
	PAGING_Init();
	MEM_Init();
	CALLBACK_Init();
	PIC_Init();
	PROGRAMS_Init();
	TIMER_Init();
//	CMOS_Init();
	VGA_Init();
	CPU_Init();
	KEYBOARD_Init();
	BIOS_Init();
	INT10_Init();
	MOUSE_Init();
	SERIAL_Init();
	PARALLEL_Init();
	printTimeout = ConfGetBool("timeout");
	DOS_Init();
	XMS_Init();
	EMS_Init();
	if (errorMess[0])
		MessageBox(NULL, errorMess+1, "vDos: CONFIG.TXT has unresolved items", MB_OK|MB_ICONWARNING);
	SHELL_Init();																	// Start up main machine
	}