This is a window controller i made to drive the windows in a car.
Because I made some mistakes on the circuit board, I have made a extra circuit board for driving the power transistors.
I have decided to release all the designs and the code off this project:
The layout of V2.1:
The layout of 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.
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