BiPOM Forum

General => Microcontroller Development Systems => 8051 Development Tools => Topic started by: enliteneer on December 07, 2005, 01:23:44 pm

Title: How To Declare \'Alternate Function\' vs GPIO
Post by: enliteneer on December 07, 2005, 01:23:44 pm
  How do you tell the micro-c compiler that you want to use the pin as a general purpose i/o versus use a  alternative function (like pwm)..
   
 For example, the PWM uses pins CEX0-CEX4, and according to the 8051 datasheet, the port pin must be set to to \'1\' inorder for the pwm to drive it.
 HOWEVER, If I set the bit this way, "setbit(1.3)", this will configure it as an \'input\', right?
 
Is there another way to initialize a port for gpio+direction and alternative function?
Title: Re: How To Declare \'Alternate Function\' vs GPIO
Post by: vitaliy on December 08, 2005, 03:59:27 pm
Please read
http://www.bipom.com/cgi-bin/yabb/YaBB.pl?board=8051;action=display;num=1114595527

setbit(P1.3) ;// input or weak pull-up output
clrbit(P1.3); // low output
Title: Re: How To Declare \'Alternate Function\' vs GPIO
Post by: vitaliy on December 08, 2005, 04:05:48 pm
here is PWM example
http://www.bipom.com/support/PWM.zip