void main(void) { /* Write your local variable definition here */ int a = 0; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ setReg(ADC_CLIST1,0x12); setReg(ADC_SDIS,0xFF88); setRegBitGroup(ADC_CTRL1,SMODE,0x01); AD1_Enable(); Cpu_EnableInt(); while(1) { WDog1_Clear(); a++; if(a) a = 0; } }
void main (void){ Timer::setBaseTimerDefault(*BaseTimers_1ms_40ms::getInstance()); /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ byte leds =0; FrenteDH::getInstancia()->getDisplay(0)->write("nico"); //FrenteDH::getInstancia()->getDisplay(1)->write("t "); //FrenteDH::getInstancia()->setLed(1,0); //FrenteDH::getInstancia()->setLed(1,2); for(;;){ WDog1_Clear(); p.mainLoop(); /*byte tecla = FrenteDH::getInstancia()->getTecla(); if(tecla){ if(tecla=='u') leds++; else if(tecla=='d') leds--; FrenteDH::getInstancia()->setLed((leds%4)==0,0); FrenteDH::getInstancia()->setLed((leds%4)==1,1); FrenteDH::getInstancia()->setLed((leds%4)==2,2); FrenteDH::getInstancia()->setLed((leds%4)==3,3); } */ } }
void main (void){ timer= newObj(Timer,(ulong)500); /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ Teclas_Init(); Display_Init(); // Inicializacion del display Grabacion_Init(); newAllocObj(&mainThread,ThreadAdjuntable); cap=GET_INSTANCE(); #ifdef _ENTRADA_SIMULADA CapturadorSimulado_setMicroSegundos(cap,100000000); CapturadorSimulado_setPulsos(cap,2); #endif { void * adjuntador= ThreadAdjuntable_getAdjuntador(&mainThread); newAllocObj(&sensorRpm,SensorRpm,adjuntador,1000,cap,&config,"SEn rPM"); deleteObj(&adjuntador); } for(;;){ WDog1_Clear(); if(Timer_isfinish(timer)){ Timer_Restart(timer); _GetterPrint(&sensorRpm,1); // Pasar_Numero(Capturador_getMicroSegundos(cap)/1000,0,0); // Pasar_Numero(Capturador_getPulsos(cap),1,0); // CapturadorSimulado_setPulsos(cap,CapturadorSimulado_getPulsos(cap)+1); } //Eventos MethodContainer_Execute(&mainThread); } }
void main (void){ char tecla; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ newAlloced(&plataforma,&PlataformaEmbedded); Teclas_Init(); Display_Init(); // Inicializacion del display com_initialization(&arrayNodosComunicacion); add1msListener(_new(&Method,on1ms,0)); add40msListener(_new(&Method,on40ms,0)); newAlloced(&mainThread,&ThreadAdjuntable); cap=GET_INSTANCE(); #ifdef _ENTRADA_SIMULADA CapturadorSimulado_setMicroSegundos(cap,100000000); CapturadorSimulado_setPulsos(cap,2); #endif { void * adjuntador= ThreadAdjuntable_getAdjuntador(&mainThread); newAlloced(&sensorRpm,&SensorRpm,adjuntador,1000,cap,&config,"SEn rPM"); _delete(adjuntador); } newAlloced(&pwm,&PWMTimer,&pwm_config,0); newAlloced(&pid,ControlPID,&pid_config,&sensorRpm,&pwm); newAlloced(&msj[0],MessageOut); #ifndef HD90 PID_AddOnTSalChange(&pid,OnTSalChange,NULL); #endif /* DN_Init(&CBox_Pri); Sets_Init(); PWM_Hmi_Add(&pwm,0); SenRpmHmi_Add(&sensorRpm,0); PidHmi_AddBoxes(&pid,0); // PidHmi_AddBoxes(&pid,2); // PidHmi_AddBoxes(&pid,3); Sets_AddBoxes(); */ DN_staticInit(&OpList,&AccessList); setConectada(&pwm,TRUE); LedsSalida_init(&ledsSalida); for(;;){ WDog1_Clear(); tecla=get_key(); //Eventos MethodContainer_execute(&mainThread); mainLoop(&plataforma); DN_Proc(tecla); } }
void main (void){ struct Timer * t1=newObj(Timer,(ulong)1000); struct Timer *t2=newObj(Timer,(ulong)4000); struct Timer *t3=newObj(Timer,(ulong)6000); struct Timer *t4=newObj(Timer,(ulong)8000); struct Timer *t5=newObj(Timer,(ulong)10000); struct Timer *t6=newObj(Timer,(ulong)12000); struct Timer *t7=newObj(Timer,(ulong)18000); int a = 1; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ Display_Init(); // Inicializacion del display PutValLed(1,0); //lrReg8Bits(TIE, 1); /*ComunLeds_SetVal(); for(;;){ WDog1_Clear(); Display2_PutVal(a); if(Timer_isfinish(t1)){ a<<=1; Timer_Restart(t1); if(a==0) a=1; } // clrReg8Bits(DDRA, DDRA_BIT0_MASK); setReg8Bits(PORTA,0); bits5ULN_PutVal(0); } */ for(;;){ WDog1_Clear(); if(t1 && Timer_isfinish(t1)){ PasarASCII("Ok88",0); //texto fijo deleteObj(&t1); } if(t2 &&Timer_isfinish(t2)){ deleteObj(&t2); PasarASCII("P.8o.8",1); //texto fijo con punto } if(t3 &&Timer_isfinish(t3)){ deleteObj(&t3); Pasar_Numero(2568,1,0); //paso numero de 4 cifras } if(t4 &&Timer_isfinish(t4)){ deleteObj(&t4); Pasar_Numero(25681,0,1); //paso numero de 5 cifras } if(t5 &&Timer_isfinish(t5)){ deleteObj(&t5); PasarASCII("P.dhAcEL",0); //texto scroll con punto } if(t6 &&Timer_isfinish(t6)){ deleteObj(&t6); PasarASCII("V 000.7",1); //texto scroll con punto } if(t7 &&Timer_isfinish(t7)){ deleteObj(&t7); PasarASCII("JoniM",1); //texto scroll con punto } } }
void main (void){ int teclas=0; char tecla; struct Timer * timer=newObj(Timer,(ulong)30); /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ Teclas_Init(); Display_Init(); // Inicializacion del display for(;;){ WDog1_Clear(); tecla=get_key(); if(tecla=='u'){ PasarASCII(" uP ",0); //texto fijo teclas++; } if(tecla=='d'){ PasarASCII("down",0); //texto fijo teclas++; } if(tecla=='r'){ PasarASCII("enter",0); teclas++; } if(tecla=='k'){ PasarASCII("eSc ",0); //texto fijo teclas++; } if(tecla=='f'){ PasarASCII("MAntEnidA",0); //texto fijo teclas++; } if(tecla=='s'){ PasarASCII("StoP",0); //texto fijo teclas++; } if(Teclas_TimePass() && Timer_isfinish(timer)){ PasarASCII("tiEMPo",0); //texto fijo teclas=0; Timer_Restart(timer); } if(Timer_isfinish(timer)){ Pasar_Numero(teclas,1,0); Timer_Restart(timer); } } }