int main()
{
    PCComms_SetCustomInterruptHandler(&SerialCB);
    DisableAll();
    PCComms_Start();
    MotorComms_Start();
    Timer_1_Start();
    CyGlobalIntEnable;
    OpenExhaust_Write(1);
    CloseExhaust_Write(1);
    
    for(;;)
    {
        CyDelay(10);
        if(linesz !=0)
        {
            if(line[linesz-1]=='\n' || line[linesz-1]=='\r') //Assume that the computer isn't doing anything funky. 
            //Q. What is our computer's favorite dance?
            //A. The Robot!
            {
                parseSerial(line,linesz);
                line[linesz]='\0';
                linesz=0;                
            } 
        }
        else
       MotorComms_UartPutString("Boop");
    }
}
Exemple #2
0
int main()
{   
    /* Enable the global interrupt */
    CyGlobalIntEnable;
    
    /* Enable the Interrupt component connected to interrupt */
    isr_keypress_StartEx(KeyHandler);
    isr_lights_StartEx(InterruptHandler);

	/* Start the components */
    Timer_1_Start();
    debounce_clock_Start();
    
    showTime();
    while (1) {
        if (halfSecond == 0) {
            if (millis > 500) {
                halfSecond = 1;
                showTime();
            }
        } else {
            if (millis <= 500) {
                halfSecond = 0;
                showTime();
            }
        }
    }
    
    return 0;
}
Exemple #3
0
//Timebase timers init:
void init_tb_timers(void)
{
	//Timer 1: 1ms (LEDs, PID)
	Timer_1_Init();
	Timer_1_Start();
	isr_t1_Start();
}
Exemple #4
0
int main()
{
    CyGlobalIntDisable;
    isr_sw_StartEx(SW_Int);

    
    CyGlobalIntEnable;      /* Enable global interrupts */

    UART_1_Start();
    Timer_1_Start();
    Timer_2_Start();
    
    
    for(;;)
    {

      if(press == 2){
            
                        
            time_s = abs(seconds_new - seconds_old)/1000;
            time_ms = (ms_old + 24000 - ms_new);
            
            UART_1_UartPutString("\n \r Time Between Presses: ");
            PrintInt(time_s);
            UART_1_UartPutString(".");
            PrintInt(time_ms);
            UART_1_UartPutString(" s");
            press = 0; 
        }
}
}
Exemple #5
0
int main()
{
    /* Place your initialization/startup code here (e.g. MyInst_Start()) */
    Timer_Start();
    Timer_1_Start();
    timer_int_StartEx(TIMER_ISR);
    timer1_int_StartEx(TIMER1_ISR);
    CyGlobalIntEnable; /* Uncomment this line to enable global interrupts. */
    for(;;)
    {
        /* Place your application code here. */
    }
}
Exemple #6
0
int rread(void)
{
    SC0_SetDriveMode(PIN_DM_STRONG);
    SC0_Write(1);
    CyDelayUs(10);
    SC0_SetDriveMode(PIN_DM_DIG_HIZ);
    Timer_1_Start();
    uint16_t start = Timer_1_ReadCounter();
    uint16_t end = 0;
    while(!(Timer_1_ReadStatusRegister() & Timer_1_STATUS_TC)) {
        if(SC0_Read() == 0 && end == 0) {
            end = Timer_1_ReadCounter();
        }
    }
    Timer_1_Stop();
    
    return (start - end);
}
Exemple #7
0
int main()
{
	Timer_1_Start(); // Configure and enable ms timer
    PWM_1_Start(); // Configure and enable PWM module
	
	
	blue_isr_StartEx(BLUE_ISR); // Point to BLUE_ISR to turn on the blue LED
	red_isr_StartEx(RED_ISR); // Point to RED_ISR to turn on the red LED
	tc_isr_StartEx(TC_ISR); // Point to TC_ISR to turn off both LEDs
	ms_isr_StartEx(MS_ISR); // Point to MS_ISR to update the compare values

    CyGlobalIntEnable; // Enable global interrupts
	
    for(;;)
    {
        PWM_1_WriteCompare1(comp_val1); // Write new compare value to PWM output 1
		PWM_1_WriteCompare2(comp_val2); // Write new compare value to PWM output 2
    }
}
Exemple #8
0
void sonido(uint8 ld)
{
    SDown_Write(1);
    CyDelay(250);
    if(ld==1){
        isr_1_StartEx(Interrupcion_1);
        Timer_1_Start();
        VDAC8_1_Start();
        i1=0;
        NextSample_1=0;
    }
    else{
        isr_2_StartEx(Interrupcion_2);
        Timer_2_Start();
        VDAC8_2_Start();
        i2=0;
        NextSample_2=0;        
    }
    
}