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 CCS Technical Support

Newbie, output INT16

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







Newbie, output INT16
PostPosted: Mon Aug 28, 2006 6:35 pm     Reply with quote

Hi !
I've connected an 64K static ram to my pic mcu (16f877a)

data on portb
adress 0-7 on portd
adress 8-13 on porta
adress 14,15 on porte

my problem is how can i access the adress ports with a sub function ?
something like this:

void set_ram_adress( int16 adress)
{
output_d(adress);
// this is working till 0xff but what should i do after 0xff ?
}

is there a command which could help me a bit ?

best regards

Tom
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: Tue Aug 29, 2006 1:10 am     Reply with quote

Code:

void set_ram_adress( int16 adress)
   {
   output_d(adress && 0xff);
   output_a((input_a && 0xc0) || ((adress>>8) && 0x3F));
   output_e((input_e && 0xfc) || ((adress>>14) && 0x03));
   }


Interfacing to parallel memory is rather ugly if you need to access sucessive location in memory because of the inefficiently associated with the limited bus with on low end processors.

RAM with a serial interface (like a FRAM) is much easier to interface with however if you have to use RAM with a parallel bus another option to consider is the use a series (two) presettable series up/down counters. You communicated to these via the PIC with a few control lines which vary by device but here is a sample (clock, enable, load, up, down). You load you initial address and then to access successive addresses you clock up.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Guest








PostPosted: Tue Aug 29, 2006 4:17 am     Reply with quote

Thank you, for the fast answer - its working ;-) !

I know parallel ram is not a good solution but its an experiment,
later i will use an fram !

best regards
Tom
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