Help Needed for C programming

Thread Starter

Ralf

Joined Mar 16, 2009
31
guy if u all read my previous thread knowing that i using MPLAB IDE v8.20a C compiler to write C programming for my microchip 18f24k20 but now i have a problem.. i doing the same project but due to the microchip problem. i have change the chip to 18f252.

i wanted to know that if i using the below code will i display anything? or is setting it as a input/output?

PORTA = 0x00
or
TRISA = 0x00
or
LATA = 0x00

which one is to send information of 0x00 ???
 

maxpower097

Joined Feb 20, 2009
816
Not sure about the pic18 but for the pic24 it should be

PORTA = 0x00 - Sets all pins off or 0 for portA
or
TRISA = 0x00 - Sets all pins in portA as Outputs

To make them inputs and turn them on you should use 0xFF.
0x00 = 00000000
0xFF = 11111111
 
Last edited:

dsp_redux

Joined Apr 11, 2009
182
Not sure about the pic18 but for the pic24 it should be

PORTA = 0x00 - Sets all pins off or 0 for portA
or
TRISA = 0x00 - Sets all pins in portA as inputs

To make them outputs and turn them on you should use 0xFF.
0x00 = 00000000
0xFF = 11111111
The inverse is true for some pic... For the dsPIC4013, you use TRISA = 0x0000 for outputs and TRISA = 0xFFFF for inputs. Just read about that register in the manual. But it is supposed to be something like that.
 
Top