General > 8051 Development Tools
How To Declare \'Alternate Function\' vs GPIO
(1/1)
enliteneer:
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:
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:
here is PWM example
http://www.bipom.com/support/PWM.zip
Navigation
[0] Message Index
Go to full version