We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi :
Take a look at this function
sbit a=P0^1; void manipulate_port() { a=1; Delay(); a=0; Delay(); a=1; Delay(); a=0; }
In above code, the hardware(P0.1) is manipulated in the function manipulate_port(); Now I want to manipulate one of the pins of PORT0 according to different parameter. I can program eight different process with eight different pin manipulation and then select which process to be executed by a parameter. But I donot think it is a properly method. Should I only use one process to complete such goal. Because the manipulation is fixed(no matter which pin is use) So shall I program the process in such way.
sbit a0=P0^1; sbit a1=P0^2; ........ sbit a7=P0^7; void manipulate_port(uchar x) { // according different x, the a will be point to different pin,then execute the following a=1; Delay(); a=0; Delay(); a=1; Delay(); a=0; }
Is this resonable(or is this idea will be supported by keil)? If so ,how can I do it.
Thanks for your replying.
Jason Liu
The 8051 architecture doesn't have any thing that can "point to" a port pin. since the OP is oblivious to that fatc it is time for some reading for him.
doing ANYTHING with a '51 without reading "the bible" first is sheer folly
Erik
here are the links to "the bible" Chapter 1 - 80C51 Family Architecture: www.nxp.com/.../80C51_FAM_ARCH_1.pdf
Chapter 2 - 80C51 Family Programmer’s Guide and Instruction Set: www.nxp.com/.../80C51_FAM_PROG_GUIDE_1.pdf
Chapter 3 - 80C51 Family Hardware Description: www.nxp.com/.../80C51_FAM_HARDWARE_1.pdf