Eric_O
Advanced Member level 4
Bonjour,
In MikroC, for PIC 16F887 which I’m using now, could some body explain me clearly, simply what the difference between :
TRISD = 0b00001100;
and
PORTD.B2 = 1;
PORTD.B3 = 1;
Before, in main() I wrote ...
PORTD = 0;
Hardware :
switch DOWN connected between GND and pin b2 of PORTD, and pull-up resistor 10 k between VCC and pin b2 of PORTD
switch UP connected between GND and pin b3 of PORTD, and pull-up resistor 10 k between VCC and pin b3 of PORTD
Others questions :
At de beginning of main() is there an order to write ...
PORTD = 0;
TRISD = 0;
or
TRISD = 0;
PORTD = 0;
Can you please remind me which initial and first line of code or necessary in order to set (or reset) properly the MCU ?
In the attached photo :
The first 5 lines in the beginning on main() are they necessary ? I do not use ADC and Comparators in my code.
PORTD = 0; in the code (left) but PORTD = 00001000 in the Debugger Watch Values window (right).
Merci beaucoup !
Eric
In MikroC, for PIC 16F887 which I’m using now, could some body explain me clearly, simply what the difference between :
TRISD = 0b00001100;
and
PORTD.B2 = 1;
PORTD.B3 = 1;
Before, in main() I wrote ...
PORTD = 0;
Hardware :
switch DOWN connected between GND and pin b2 of PORTD, and pull-up resistor 10 k between VCC and pin b2 of PORTD
switch UP connected between GND and pin b3 of PORTD, and pull-up resistor 10 k between VCC and pin b3 of PORTD
Others questions :
At de beginning of main() is there an order to write ...
PORTD = 0;
TRISD = 0;
or
TRISD = 0;
PORTD = 0;
Can you please remind me which initial and first line of code or necessary in order to set (or reset) properly the MCU ?
In the attached photo :
The first 5 lines in the beginning on main() are they necessary ? I do not use ADC and Comparators in my code.
PORTD = 0; in the code (left) but PORTD = 00001000 in the Debugger Watch Values window (right).
Merci beaucoup !
Eric