Benutzer:Rdnzl/netio opto

Aus Ethersex_Wiki
< Benutzer:Rdnzl
Version vom 10. Juli 2010, 14:06 Uhr von Rdnzl (Diskussion | Beiträge) (Die Seite wurde neu angelegt: = Net-IO schaltet ATX per Optokoppler = == Schema == Bild:Opto_netio.png‎ == Oben == Bild:DSCN7449.JPG == Unten == Bild:DSCN7448.JPG == Pinning ==...)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche

Net-IO schaltet ATX per Optokoppler

Schema

Opto netio.png

Oben

DSCN7449.JPG

Unten

DSCN7448.JPG


Pinning

PA0     INPUT    LOW        LED_1
PA1     OUTPUT   HIGH       PWR_1
PA2     INPUT    LOW        LED_2
PA3     OUTPUT   HIGH       PWR_2
PA4     INPUT    LOW        LED_3
PA5     OUTPUT   HIGH       PWR_3
PA6     INPUT    LOW        LED_4
PA7     OUTPUT   HIGH       PWR_4


Control6

uint8_t clear1 = 0;
uint8_t clear2 = 0;
uint8_t clear3 = 0;
uint8_t clear4 = 0;
uint8_t delay = 2;

CONTROL_START

    THREAD(delay_pin1)
        TIMER_START(t1)
        TIMER_WAIT(t1, delay)
        PIN_CLEAR(PWR_1);
        DEBUG("clear: 1")
        clear1 = 1;
    THREAD_END(delay_pin1)

    THREAD(delay_pin2)
        TIMER_START(t2)
        TIMER_WAIT(t2, delay)
        PIN_CLEAR(PWR_2);
        DEBUG("clear: 2")
        clear2 = 1;
    THREAD_END(delay_pin2)

    THREAD(delay_pin3)
        TIMER_START(t3)
        TIMER_WAIT(t3, delay)
        PIN_CLEAR(PWR_3);
        DEBUG("clear: 3")
        clear3 = 1;
    THREAD_END(delay_pin3)

    THREAD(delay_pin4)
        TIMER_START(t4)
        TIMER_WAIT(t4, delay)
        PIN_CLEAR(PWR_4);
        DEBUG("clear: 4")
        clear4 = 1;
    THREAD_END(delay_pin4)

    ON ( clear1 ) DO DEBUG("stop: 1") THREAD_STOP(delay_pin1) clear1 = 0; END
    ON ( clear2 ) DO DEBUG("stop: 2") THREAD_STOP(delay_pin2) clear2 = 0; END
    ON ( clear3 ) DO DEBUG("stop: 3") THREAD_STOP(delay_pin3) clear3 = 0; END
    ON ( clear4 ) DO DEBUG("stop: 4") THREAD_STOP(delay_pin4) clear4 = 0; END

    ON PIN_RISING(PWR_1) DO DEBUG("rising: 1") THREAD_RESTART(delay_pin1) END
    ON PIN_RISING(PWR_2) DO DEBUG("rising: 2") THREAD_RESTART(delay_pin2) END
    ON PIN_RISING(PWR_3) DO DEBUG("rising: 3") THREAD_RESTART(delay_pin3) END
    ON PIN_RISING(PWR_4) DO DEBUG("rising: 4") THREAD_RESTART(delay_pin4) END

CONTROL_END