Window controller – Update

I have decided to release all the designs and the code off this project:

The layout of V2.1:
Printplaat V2_1Printplaat V2_1

The layout of V2.2:
Printplaat V2_2
Printplaat V2_2

There are still some errors in this layout. If you want to use the design I recommend that you compare it to the circuit and correct it.

 

The code:

    Device 12F629
    Config INTRC_OSC_NOCLKOUT, WDT_OFF, PWRTE_ON, MCLRE_ON, CP_ON
    ALL_DIGITAL     TRUE
    
    Dim tellerlaag  As Byte
    Dim tellerhoog  As Byte
    Dim ICounter    As Byte
    Clear
    
    Symbol stroomSensor = PORTB.0
    Symbol knopOmhoog   = PORTB.4
    Symbol knopOmlaag   = PORTB.5
    Symbol UitR         = PORTB.2
    Symbol UitL         = PORTB.1
    
    Low UitR
    Low UitL
   
Main:
    While 1 = 1
        If knopOmhoog = 0 And knopOmlaag = 1 And stroomSensor = 0 Then
            GoSub Omhoog
        EndIf
        If knopOmlaag = 0 And knopOmhoog = 1 And stroomSensor = 0 Then
            GoSub Omlaag
        EndIf
    Wend


Omhoog:
    Low UitL
    High UitR 
    DelayMS 500
    While 1 = 1 
        If knopOmlaag = 0  Or stroomSensor = 1 Then
            Low UitR
            GoTo wachten
        EndIf 
    Wend


Omlaag:
    Low UitR
    High UitL 
    DelayMS 500
    While 1 = 1 
        If knopOmhoog = 0  Or stroomSensor = 1 Then 
            Low UitL
            GoTo wachten
        EndIf 
    Wend


wachten:
    DelayMS 1000
    Return
    
End

Leave a Reply

Your e-mail address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.