Set Fixed Frequency

my schematic is too large to be upload. Sorry.
Planning to do something like PFC.

Would like to know how to set a fixed frequency 300kHz for my arduino as i am going to make the microcontroller to work like a function generation.
and how can i program the duty cycle that when i change the Vin and there is a fixed output of 10V

I am using a 330uH inductor which is a bit small so i need a high frequency to ensure a continue waveform.
THERE IS A 12V VDD GOING TO MOSFET DRIVER (TC1427CPA) THE OUTPUT OF THE MOSFET DRIVER WILL BE CONNECTED TO MOSFET GATE (19N10). VIN WILL BE CONNECTED TO INDUCTOR OF 330uH WHICH LATER CONNECTED TO THE DRAIN OF THE MOSFET. A DIODE (AA4) WILL BE USED AND 150 ohm RESISTER LOAD AND 1000uF CAPACITOR.

Sorry, not clear what you want.

You want the Arduino running at 300khz? Or a squarewave output at 300khz?

And what are you going on about components on your circuit?! You haven't asked any question about it, told us what it's supposed to do, or posted a schematic - I'm not sure how you expect us to comment on that?
Or are you also talking about making a buck/boost converter? (why not buy one? They're cheap as dirt on ebay)

i want to replace arduino uno microcontroller with function generator to control my boost converter. have setting of pulse wave, 5 Vpp and offset of 2.5V and 300kHz will allow me to have a continuous current waveform for my circuit.

my aim to to create a fixed output of 10V when my Vin is vary from 1V to 5V by programming the coding to vary the duty cycle to match the output.
i have already fabricate a dc- dc boost converter.

i have found a coding to set a fixed frequency but it give me an error saying InitTimersSafe() and SetPinFrequencySafe are not declare and i am not sure what to do.

#include <PWM.h>
int32_t frequency = 33000;
// the setup routine runs once when you press reset:
void setup()
{
//initialize all timers except for 0, to save time keeping functions
InitTimersSafe();

//sets the frequency for the specified pin
bool success = SetPinFrequencySafe(9, frequency);

//if the pin frequency was set successfully, pin 13 turn on
if(success) {
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
}
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
analogWrite (9, sensorValue / 4);
delay(30); // delay in between reads for stability
}

I think you may be missing at least one include file and possibly another source file for the software you have obtained.

If you are building a boost converter, you do not feed a signal into the pump circuit. The inductor is part of an oscillating circuit which runs on its own at a frequency determined by the component values in that circuit. I really can't imagine the havoc that an external 300kHz signal would cause.

Unless I really misunderstand what you are doing. If so, a schematic is mandatory. Surely a boost converter is not too large to post.

I have done research on mosfet and programming code to do about arduino uno for boost converter but i couldn't find the information that i need.

Not sure on how to do the coding for microcontroller to program the mosfet driver of the boost converter to control the ON/ OFF pwm.
and also how to control mosfet with mosfet driver from boost converter to produce PWM (pulse voltage waveform)and current wave form that when ON the waveform increased linearly and OFF the waveform decreased linearly.
As my project aims to create a better power factor correction of nearly 1 with the help of boost converter so i would need to self program my microcontroller.

thank you

i wanna create an active power factor correction. my aim is to have the same output current as i use function generator. hoping to do the coding for microcontroller to program the mosfet driver of the boost convert to control the ON/ OFF pwm.
and also control mosfet with mosfet driver from boost converter to produce PWM (pulse voltage waveform)and current wave form that when ON the waveform increased linearly and OFF the waveform decreased linearly.

but currently i am not sure how to code on the microcontroller to on/off the mosfet driver for mosfet.

You use the analogWrite function to a PWM pin to controll the on/off duty cycle of your FET.

but there is a fixed frequency of the PWM pin and causing my current waveform to be discontinuous. so i am doing my own digital IO.

I realize that when i add delay or increase the delay. my frequency change smaller and my current waveform will be discontinuous. is there any way to ensure that there is a fixed frequency whenever i my duty cycle change?
this is my coding :

const int IOPin = 9;
int IOState=LOW;

void setup()
{
pinMode(IOPin, OUTPUT); // sets the digital pin as output
}

void loop()
{
if (IOState==LOW)
{
IOState= HIGH; // sets the ON
delayMicroseconds(1);
}
else
{
IOState= LOW; // sets the OFF
delayMicroseconds(1);
}

digitalWrite(IOPin, IOState);

}

You are wrong. It is a fixed frequency no matter what the duty cycle is ( unless it is 100% or 0% ).
so you are not explaining what you want to do using the correct words So it is hard to say how to acheave what you want.

Use code that ( the </> icon ) when posting code if you want me to look at it.