CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

LAT v PORT

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Storic



Joined: 03 Dec 2005
Posts: 182
Location: Australia SA

View user's profile Send private message Send e-mail

LAT v PORT
PostPosted: Mon Dec 11, 2006 6:37 am     Reply with quote

A question on LAT and PORT. in this link http://www.ccsinfo.com/forum/viewtopic.php?t=29126
I made ref to the PORT BIT,
Code:
#byte State_L = 0xF81 // PORT B; PORT A = 0xF80
#bit Status_LED = State_L.2

the example reference LAT BIT.
Code:

#byte    Port_B = 0xF8A
#bit     Status_LED = Port_B.5

I used the PORT BIT when testing weather the PORT BIT is High or Low,
Can I assume that LAT BIT controls the BIT high or low.

ANdrew
_________________
What has been learnt if you make the same mistake? Wink
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Mon Dec 11, 2006 8:25 am     Reply with quote

Read the PORT bit, write the LATch bit.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Storic



Joined: 03 Dec 2005
Posts: 182
Location: Australia SA

View user's profile Send private message Send e-mail

PostPosted: Mon Dec 11, 2006 3:13 pm     Reply with quote

Smile Thanks
I found this after my post, your help is clearer than the extracted quote below

Confused (as extracted from the microchip pdf file "39564c.pdf")
Quote:

Each port has three registers for its operation. These
registers are:
• TRIS register (data direction register)
• PORT register (reads the levels on the pins of the
device)
• LAT register (output latch)
The data latch (LAT register) is useful for read-modify-
write operations on the value that the I/O pins are
driving.

The Data Latch register (LATB) is also memory
mapped. Read-modify-write operations on the LATB
register reads and writes the latched output value for
PORTB.

extracted from "9.0 I/O PORTS"

ANdrew
_________________
What has been learnt if you make the same mistake? Wink
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group