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

Using PORTD & External ram

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







Using PORTD & External ram
PostPosted: Fri Aug 31, 2001 6:27 am     Reply with quote

I have a PIC16F877 and I connected an external parallel ram to it.
PORTD is my data bus.

my question: is it ok to keep changing the port from an in to an out every time I want to read / get the data ?

what I do now is make the port an output using "set_tris_d(0x00);"
then I write data to ram.

then when I want to read it I make the port an input "set_tris_d(0xFF);" and then read the data.

am I doing this right ? or have I totally missed something.

Thanks, Jim
___________________________
This message was ported from CCS's old forum
Original Post ID: 126
Doug Kennedy
Guest







Re: Using PORTD & External ram
PostPosted: Fri Aug 31, 2001 6:55 am     Reply with quote

:=I have a PIC16F877 and I connected an external parallel ram to it.
:=PORTD is my data bus.
:=
:=my question: is it ok to keep changing the port from an in to an out every time I want to read / get the data ?
:=
:=what I do now is make the port an output using "set_tris_d(0x00);"
:=then I write data to ram.
:=
:=then when I want to read it I make the port an input "set_tris_d(0xFF);" and then read the data.
:=
:=am I doing this right ? or have I totally missed something.
:=
:=Thanks, Jim
Yes this works fine for me aslong as the read write memory line is syncd
( you don't want to read while you are writing thus having the SRAM and portd fighting each other )
___________________________
This message was ported from CCS's old forum
Original Post ID: 127
John P
Guest







Re: Using PORTD & External ram
PostPosted: Fri Aug 31, 2001 2:58 pm     Reply with quote

:=I have a PIC16F877 and I connected an external parallel ram to it.
:=PORTD is my data bus.
:=
:=my question: is it ok to keep changing the port from an in to an out every time I want to read / get the data ?

Yeah, I've done this, also using PORTD. I used two 74HC374 octal buffers to store first the low, then the high, address bytes, then to write I put the data on PORTD and activate an additional strobe to load it to the RAM. To read, turn the port into inputs and hit a strobe to activate the RAM's -OE line. So you need the 8-bit port and 4 additional control lines (strobe addr high, strobe addr low, read and write). It's cumbersome, but it does work.

I also took the outputs from the octal buffers and connected each one to an LED. The address lines have no effect when the RAM isn't read or written, so I do a "dummy operation" which sets the address bits but doesn't read or write. By doing this at a suitable rate I've set up a "bouncing light" which goes up and down the row of LEDs twice a second or so. It's fun and it also verifies that every address bit is functioning and that the processor's timing interrupt is working.
___________________________
This message was ported from CCS's old forum
Original Post ID: 139
Robert
Guest







Re: Using PORTD & External ram
PostPosted: Sun Nov 20, 2005 7:37 am     Reply with quote

Could you please tell me what RAM chip you use?

jim wrote:
I have a PIC16F877 and I connected an external parallel ram to it.
PORTD is my data bus.

my question: is it ok to keep changing the port from an in to an out every time I want to read / get the data ?

what I do now is make the port an output using "set_tris_d(0x00);"
then I write data to ram.

then when I want to read it I make the port an input "set_tris_d(0xFF);" and then read the data.

am I doing this right ? or have I totally missed something.

Thanks, Jim
___________________________
This message was ported from CCS's old forum
Original Post ID: 126
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