Question

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?

Was it helpful?

Solution

#define portOut1 pin_c0
output_bit(portOut1, value)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top