• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC24F digital lines I/O...need help

Status
Not open for further replies.

puneetnepsam

New Member
hi i am a beginner in the embedded systems.....please help

in the I/O ports section i have read.....
TRIS register means that it will define the direction of the pin which is connected to the particular port
exmple:

TRISGbits.TRISG1 = 1 will make that line in the input mode...

but what does
PORTGbits.PORTG1 = 1;
and
LATGbits.LAT1 = 1;

means??

does it mean that it would write 1 to the corresponding line??

thanks
Puneet Gupta
 

AtomSoft

Well-Known Member
Somewhat yes...
PORTx pins are for reading a pin usually but can be used to set the pin also when the TRISx is set to output.

Its recommended to use LATx pins to set the output to HIGH or LOW when the TRISx of said pin is ouput.

so LATx and PORTx are almost the same but LATx is meant for setting the pin HIGH/LOW

While PORTx is meant to read the pin but can be used to set it also.

TRISx is for direction Input/Output
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top