Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed BufferedSerial Servo2 PCT2075 I2CEeprom FastPWM
field.h
00001 #include "mbed.h" 00002 /** 00003 Functions to control alternator field 00004 */ 00005 00006 00007 /**void set_pwm (double d) { Range 0.0 to 1.0 00008 This PWM used to limit max duty ratio of alternator field energisation. 00009 With R25=33k and C4=100n controlling ramp input to CS pin of MCP1630 (not MCP1630V), 00010 ramp terminates fet 'on' pulse after a max of approx 980 us. 00011 With const int PWM_PERIOD_US = 2000 , duty ratio is thus limited to approx 50% max. 00012 This is about right when using 12V alternator on 24V systems 00013 A 1.225V reference (U7) is fed to the MCP1630 error amp which compares this to fed-back proportion of system voltage. 00014 This adjusts final PWM down to zero % as needed to maintain alternator output voltage. 00015 */ 00016 00017 class FieldControl { 00018 uint8_t privatemadetab[440]; 00019 uint64_t t_on, t_off, measured_pw_us, measured_period, rise_count, fall_count; 00020 uint32_t old_percent; 00021 PwmOut pwm_osc_in; // Controller PWM driving MCP1630 00022 InterruptIn V_ext; // Connected to MCP1630 output to MOSFET 00023 void VextRise (); // Handles - MCP1630 has just turned mosfet on 00024 void VextFall (); // Handles - MCP1630 has just turned mosfet off 00025 public: 00026 FieldControl (PinName pwmoscin, PinName vext) ; // Constructor 00027 void set_pwm (double); // What it says, 0.0 to 1.0 but inverts to suit MCP1630 00028 void maketable (); 00029 uint32_t set_for_speed (uint32_t rpm); 00030 double get_duty_ratio () ; 00031 } ; 00032
Generated on Fri Jul 22 2022 15:22:19 by
1.7.2