Author Topic: How To Declare \'Alternate Function\' vs GPIO  (Read 10885 times)

enliteneer

  • Guest
How To Declare \'Alternate Function\' vs GPIO
« 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?

vitaliy

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: How To Declare \'Alternate Function\' vs GPIO
« Reply #1 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

vitaliy

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: How To Declare \'Alternate Function\' vs GPIO
« Reply #2 on: December 08, 2005, 04:05:48 pm »