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

LATx & PORTx registers in dsPIC30F4011 ???

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



Joined: 17 Jul 2012
Posts: 53

View user's profile Send private message

LATx & PORTx registers in dsPIC30F4011 ???
PostPosted: Wed Oct 24, 2012 4:25 am     Reply with quote

Hi everybody ! I have got a trouble that is why we need LADx register while PORTx register is available ?
temtronic



Joined: 01 Jul 2010
Posts: 9204
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Oct 24, 2012 5:19 am     Reply with quote

The short answer...we don't 'need' both but it's a 'feature' on the newer PICs. It does allow the programmer some 'options' not available decades ago.

Really you should read the datasheet on the PIC, especially the chapter on the PORTS. Then, read the same information on say the PIC16C84.
Also study the diagrams as to the structure of the ports. PICs have evolved' over the past 3 decades !

I'll lay odds that 90% of the 'features' of a PIC are not used in 90% of the projects they are used in.

This isn't a CCS C question, more a PIC philosophy one.
Ttelmah



Joined: 11 Mar 2010
Posts: 19447

View user's profile Send private message

PostPosted: Wed Oct 24, 2012 7:07 am     Reply with quote

The key one is that it avoids the RMW problem, if you write to the latch, and read from the port. On the PIC16, this was unavoidable, without using a separate RAM register and always writing to this rather than the port.

Best Wishes
small_chick



Joined: 17 Jul 2012
Posts: 53

View user's profile Send private message

PostPosted: Wed Oct 24, 2012 7:44 am     Reply with quote

thanks Ttelmah and Temtronic ! but could you explain more about RMW problem Ttelmah ? Very Happy
Ttelmah



Joined: 11 Mar 2010
Posts: 19447

View user's profile Send private message

PostPosted: Wed Oct 24, 2012 8:06 am     Reply with quote

Just do a search.
It has been covered many hundreds of times here, and on MicroChip's site, and even in a couple of application notes from them.
In fact the first google hit on "PIC RMW problem", links to a really good overview of this, and how the separate LAT access avoids this.

Best Wishes
small_chick



Joined: 17 Jul 2012
Posts: 53

View user's profile Send private message

PostPosted: Wed Oct 24, 2012 9:26 am     Reply with quote

thanks for your advice, Ttelmah ! Very Happy
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Oct 25, 2012 1:58 am     Reply with quote

temtronic wrote:
The short answer...we don't 'need' both but it's a 'feature' on the newer PICs.It does allow the programmer some 'options' not available decades ago....


Funny thing to say. I would argue that LAT is a must have for any embedded application dealing with read/write I/O where a "port" has some pins configured as inputs and others as outputs.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
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