newbie - startkit pwm mosfet GPIO default active problem

If you have a simple question and just want an answer.
georgel2004
Junior Member
Posts: 5
Joined: Thu Jan 02, 2014 4:07 pm

newbie - startkit pwm mosfet GPIO default active problem

Post by georgel2004 »

I am trying to run a pwm code to drive a mosfet through GPIO port(XS1_PORT_1H).

All the GPIO ports seems to be active by default, is this true in startkit ports?

with sample code below, the mosfet is activated even when the port is driven with 0. 

Also if i connect the mosfet gate to any port irrespective of the port used in the code, the mosfet gets activated.

Is startkit the right choice for pwm mosfet combination?

out port pwmPort = XS1_PORT_1H; //X0D23

pwmPort <: 0;
    printstrln("port at 0 ");
    delay_milliseconds ( 10000 );
    pwmPort <: 1;
    printstrln("port at 1 ");
    delay_milliseconds ( 500 );
 
Thanks
George
 



User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm

Post by Bianco »

Hi,

 

Which MOSFET are you using, how is it connected and how did you observe that it isn't working?

 

A driven output port should work.

 

In general it is not advisable to use print statements in timing sensitive code but in this case with a period of 10.5 sec this shouldn't be a problem.

 

Many MOSFETs have a high gate threshold voltage, you may require a logic level MOSFET or a MOSFET driver