![]() #define IGBT2 12 //Designating pin 12 as IGBT2 #define IGBT1 11 //Designating pin 11 as IGBT1 Here is the program with all the notes edited out so that it is in the correct format #include I am sorry that I had to upload the program as a JPEG but the program is chock FULL of comments and supporting notes. I really appreciate any help that any of you can give me! So when a potentiometer knob is turned on pin A0, both outputs will change frequency. I need the program to trigger these pins alternately and have variable frequency. As it stands, this program (I think) will output a square wave on both pin 11 and pin 12 but they are in phase (high as the same time and low at the same time). ![]() I megged them and they meg at over 60 M ohm so they are healthy. Each IGBT is rated for 400 amps because they are out of a VFD. If pin 11 and pin 12 are ever high at the same time the breaker will trip. Pin 11 needs to be High ONLY if pin 12 is Low and vis-versa. (it's not homework it's just a hobby project) I have included pictures from the mega 2560 datasheet as well. I have already written 90% of the program and am not looking for anybody to do my homework for me. The inverter I am creating takes two 120v poles from a breaker panel and converts it to a DC bus using input diode. ![]() One IGBT will handle the positive half of the square wave and the other will handle the negative. I have two IGBTs mounted on a heatsink that will pulse current from a 330 V DC bus. I am attempting to create a single phase output variable frequency square wave generator that can pass high current. I am not looking for a free ride here, just a proof-read and some pointers from the seasoned programming professionals. Please note, not all PWM mode are available on all clocks.90% of the program is already written so bear with me. Setting this to 400 results in a PWM frequency on the Arduino Mega pin of 16Mhz / 400 = 47304Hz, or possibly half that! The duty cycle is then changed by setting OCR4A or B to some value between 0 and 400įurther reading of the datasheet will explain all the registers, but hopefully this will point you in the right direction The actual frequency of the PWM is a function of these settings and the final entry, the input capture register. We have selected no prescaling, which corresponds to the native 16Mhz frequency of the Arduino clock. ![]() The CS bits relate to the clock selection, see table 17-6 in the datasheet. We have set it to mode 14, which is fast PWM with ICRn used as the maximum for the counter. The 4 statements relating to the WGM bits control the mode of operation of the PWM. Please note that the control registers 4, sections A & B will effect the PWM on all the OCR4n pins, see table above. Please see section 17.9 in the datasheet. These control the type, range and frequency of the PWM generated by the Arduino. We need to look at the timer counter control registers. This is extremely annoying as it produces a nasty noise when operating DC or stepper motors by PWM. One of the most annoying aspects of the native arduino PWM commands is that the PWM frequency is set to a value which is audible. ![]() How to change the frequency and range of the Arduino PWM? Now we can change the duty cycle using just the register Using the register is slightly faster.įirst we set the pin to output and use the analogWrite command to initialise the PWM Very simply we can use the register to set the duty cycle instead of the analogWrite command. How can we use this information on PWM registers? The following table gives the Arduino pin number and the corresponding register for controlling the duty cycle Arduino Pin Which Arduino Mega pins map to which registers in the ATMEL microcontroller? Normally you do this with the analogWrite() command, however, you can access the Atmel registers directly for finer control over the PWM on an Arduino including changing the type, range and frequency of the pulse width modulation PWM. The Arduino Mega 2560 has 15 pins which can be used for PWM output. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |