Benutzer:Rdnzl/netio opto: Unterschied zwischen den Versionen

Aus Ethersex_Wiki
Wechseln zu: Navigation, Suche
(Schema)
Zeile 4: Zeile 4:
  
 
[[Bild:Opto_netio.png‎]]
 
[[Bild:Opto_netio.png‎]]
 +
 +
Kleiner Tipp: drehe LED4 um und schaltete LED3 in Reihe zu R1. R3 entfällt. --[[Benutzer:Sven|Sven]] 22:46, 10. Jul. 2010 (UTC)
  
 
== Oben ==
 
== Oben ==

Version vom 10. Juli 2010, 23:46 Uhr

Net-IO schaltet ATX per Optokoppler

Schema

Opto netio.png

Kleiner Tipp: drehe LED4 um und schaltete LED3 in Reihe zu R1. R3 entfällt. --Sven 22:46, 10. Jul. 2010 (UTC)

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

Screenshot Named Pins

Named pins.png