// ** Grundinitialisierung ** void coldstart () { setup_adc_ports(sAN0|sAN1|sAN2|sAN3|sAN4|VSS_VDD); setup_adc(ADC_CLOCK_INTERNAL|ADC_TAD_MUL_0); setup_oscillator(OSC_8MHZ|OSC_INTRC); setup_comparator(NC_NC_NC_NC); output_a (0b00001000); output_b (0); output_c (0); output_d (0); output_e (0); set_tris_a (TRISA_INIT); // Datenrichtung Port A set_tris_b (TRISB_INIT); // Datenrichtung Port B set_tris_c (TRISC_INIT); set_tris_d (TRISD_INIT); set_tris_e (TRISE_INIT); port_b_pullups(TRUE); setup_timer_0(RTCC_INTERNAL|RTCC_DIV_32|RTCC_8_BIT); // Timer0 intern, Takt 20.00/4/64 = 78.125 KHz // Interrupt alle 256/15.625 = 3.2768 ms (305Hz) // Korrekturwert für 10 ms: 156 Timerclicks // -> Timer wird auf 256-156=100 vorgestellt set_timer0 (Timerstartwert_K); // Timerwert auf Startwert setzen enable_interrupts(INT_TIMER0); setup_timer_1(T1_DISABLED); // Nur Timer0 Interrupt delay_ms (200); }
//============================================================================= void init_prog(void) { setup_wdt(WDT_OFF); setup_adc_ports(NO_ANALOGS|VSS_VDD); setup_adc(ADC_OFF); setup_psp(PSP_DISABLED); setup_spi(SPI_SS_DISABLED); setup_timer_0(RTCC_INTERNAL|RTCC_DIV_16|RTCC_8_BIT);// TIMER0 setup_timer_1(T1_DISABLED); setup_timer_2(T2_DISABLED,0,1); setup_timer_3(T3_DISABLED|T3_DIV_BY_1); setup_comparator(NC_NC_NC_NC); setup_vref(FALSE); setup_low_volt_detect(FALSE); setup_oscillator(OSC_32MHZ); set_tris_a(0xFF);//7F set_tris_b(0xFF); //FF set_tris_c(0x94);//94 set_tris_d(0xFF); //02 set_tris_e(0xF0); //f0 set_tris_f(0xFF);//ff set_tris_g(0xFC); //04 output_a(0x00); output_b(0x00); output_c(0x00); output_d(0x00); output_e(0x00); output_f(0x00); output_g(0x00); }
//------------------------------------------------------------------------------ void init_prog(void) { setup_wdt(WDT_OFF); setup_adc_ports(NO_ANALOGS|VSS_VDD); setup_adc(ADC_OFF); setup_psp(PSP_DISABLED); setup_spi(SPI_SS_DISABLED); setup_timer_0(RTCC_INTERNAL|RTCC_DIV_16|RTCC_8_BIT);// TIMER0 setup_timer_1(T1_DISABLED); setup_timer_2(T2_DISABLED,0,1); setup_timer_3(T3_DISABLED|T3_DIV_BY_1); setup_comparator(NC_NC_NC_NC); setup_vref(FALSE); setup_low_volt_detect(FALSE); setup_oscillator(OSC_32MHZ); set_tris_a(0x00); set_tris_b(0x24); set_tris_c(0x80); set_tris_d(0x00); set_tris_e(0x15); set_tris_f(0x58); set_tris_g(0x10); output_a(0x00); output_b(0x00); output_c(0x00); output_d(0x00); output_e(0x00); output_f(0x00); output_g(0x00); // RF Modul and PA/LNA activation IOpin.modulepower=0; IOpin.moduleCTX=1; IOpin.moduleCPS=0; IOpin.modulePWRUP=1; }
void pet_userport_diagnostic_connector_t::device_start() { output_5(0); output_e(0); }
void pet_userport_joystick_and_sound_device::update_port1() { output_f(m_up1 && m_fire1); output_e(m_down1 && m_fire1); }