问题
I'm using MPLAB to compile a program in C using the CCS compiler.
I want to set an output port as high or low using defined ports.
#bit portOut1 = PORTC.0
So, I want to set my portOut1
high or low.
I had used 3 ways to do it, but just one had worked. But I'm not satisfied with that.
1: (Doesn't work, why?)
portOut1 = output5.value;
2: (Doesn't work, why?)
output_bit(portOut1,value);
3: (Obviously work)
output_bit(pin_c0, value);
I don't understand why the first and second way doesn't work.
And I don't want to use the third because I don't know what this pin do unless I comment, and I don't think that is a good program practice.
Anyone knows a way to do that? Or what I'm doing wrong?
回答1:
#define portOut1 pin_c0
output_bit(portOut1, value)
来源:https://stackoverflow.com/questions/17751843/set-output-port-high-low-c