#include "components.h" using namespace std; static void mosfet (TO220 &t, IC &opto, unsigned hole) { jumper_ground (t.pin(3,1),t.pin_y(2),"black"); unsigned y1 = t.pin_y(1); diode_from_ground (POINT(0,y1,1),y1,"blue"); resistor_ground (POINT(0,y1+1,1),y1+1,"red"); jumper (POINT(0,y1,2),POINT(0,y1+1,2),"black"); resistor (POINT(0,y1+1,3),POINT(1,y1+1,0),"red"); unsigned y2 = t.pin_y(2); diode_to_vcc (POINT(1,y2,2),y2-1,"blue"); jumper (POINT(0,y2,4),POINT(1,y2,0),"black"); jumper (POINT(1,opto.pin_y(3),4),POINT(1,t.pin_y(1)+1,hole),"black"); } extern "C" void design() { IC o1(4,3,"o1"); IC o2(4,5,"o2"); IC o3(4,7,"o3"); #if 0 const unsigned t1_y=16; const unsigned t2_y=21; const unsigned t3_y=26 #else const unsigned t1_y=20; const unsigned t2_y=25; const unsigned t3_y=30; #endif TO220 t1(false,0,t1_y,3,"t1"); TO220 t2(false,0,t2_y,3,"t2"); TO220 t3(false,0,t3_y,3,"t3"); CONNECTOR connect(0,10,3,4,"logic"); // Connecte le connecteur aux opto-coupleur POINT ground_logic(0,connect.pin_y(4),0); POINT signal1(0,connect.pin_y(1),0); POINT signal2(0,connect.pin_y(2),1); POINT signal3(0,connect.pin_y(3),2); resistor (o1.pin(1,0),signal1,"red"); resistor (o2.pin(1,1),signal2,"red"); resistor (o3.pin(1,2),signal3,"red"); jumper (o3.pin(2,3),ground_logic,"black"); jumper (o3.pin(2,2),o2.pin(2,3),"black"); jumper (o2.pin(2,2),o1.pin(2,3),"black"); jumper_vcc (o1.pin(4,4),o1.pin_y(4),"red"); jumper_vcc (o2.pin(4,4),o2.pin_y(4),"red"); jumper_vcc (o3.pin(4,4),o3.pin_y(4),"red"); // Connection vers les leds for (unsigned i=1; i<=3; i++){ unsigned y = connect.pin_y(i); resistor (POINT(0,y,4),POINT(1,y,1),"red"); } // Transfere le ground { unsigned y = connect.pin_y(4); jumper (POINT(0,y,4),POINT(1,y,0),"black"); } // Connecte les DEL for (unsigned i=1; i<=3; i++){ unsigned y = connect.pin_y(i); led (POINT(1,y,i+1),POINT(1,connect.pin_y(4),i+1),"blue"); } // Connection vers les mosfet mosfet (t1,o1,2); mosfet (t2,o2,3); mosfet (t3,o3,4); if (0){ POINT pin1(1,t1.pin_y(3),2); POINT pin2(pin1); pin2.decy(); jumper (pin1,pin2,"black"); jumper_ground (pin2,t1.pin_y(3)-1,"black"); diode_to_vcc (t1.pin(2,3),t1.pin_y(2),"green"); } }