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

External parallel ram problem

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



Joined: 09 Dec 2009
Posts: 37

View user's profile Send private message

External parallel ram problem
PostPosted: Tue Aug 24, 2010 4:01 am     Reply with quote

Hi all
It was long time for me, but finally I am back with new project full of mistakes Smile and need your help friends.

I am using 128k external parallel ram (AS6C1008) with 18f8722. The problem that I have problem with reading and writing to the ram, it works sometimes and does not alot. I think I have mistake in hardware maybe ! or a software bug because I am new to CCS .

The routines that I use for RAM :
Code:

 ////////////////////////////////////////////////////////
byte   ram_read_high(int16 address )
{
 
 int8 value;
 byte data ;
 output_h(0xd0);    //  0110  ce , ce2 , we, oe disable ram
 output_high(pin_g0);     // A16=0 ///
 output_high(pin_j2);
 output_low(pin_g3);     // enable latch to ram ///oelram of 74hc573
 
 value = make8(address,0);   // low byte
 trise=0;
 trisd=0;
 
 late=value;
 //output_e(value);
 
 value = make8(address,1);  // high byte
 latd=value;
 //output_d(value);
 output_h(0x60);    //  0110  ce , ce2 , we, oe  enable ram
 
 
 output_high(pin_g3);     // disable latch to ram ///oelram of 74hc573
 trise=0xff;
 data=porte;
 
 //data=input_e();
 
 output_h(0xd0);    //  0110  ce , ce2 , we, oe disable ram
 output_low(pin_g0);     // A16=0 ///
 output_low(pin_j2);
 return  (data);
 
 } 
 
 
void   ram_write_high(int16 address , byte data)
{
 
 int8 value , test,counter;
 counter=0;
start_write:
 
  output_h(0xd0);    //  0110  ce , ce2 , we, oe disable ram
 output_high(pin_g0);     // A16=0 ///
 output_high(pin_j2);
 
 
 value = make8(address,0);   // low byte
 trise=0;
 trisd=0;
 
 late=value;
 //output_e(value);
 
 value = make8(address,1);  // high byte
 latd=value;
 //output_d(value);
 
 output_low(pin_g3);     // enable latch to ram ///oelram of 74hc573
 //#asm
 //nop
 
 //#endasm
 output_h(0x10);    //  0100  ce , ce2 , we, oe  enable ram
 //#asm
 //nop
 
 //#endasm
 output_h(0x20);    //  0100  ce , ce2 , we, oe  enable ram
 
 
 output_high(pin_g3);     // disable latch to ram ///oelram of 74hc573
 
 late=data;
 //output_e(data);
 
 
 
 output_h(0xd0);    //  0110  ce , ce2 , we, oe disable ram
 
 output_low(pin_g0);     // A16=0 ///
 output_low(pin_j2);
}

I would like to upload the schematic but I could not find an option to do that.
I wish someone guide me to solve the ram issue and thanks in advanced.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Aug 24, 2010 11:33 am     Reply with quote

Quote:
I am using 128k external parallel ram (AS6C1008) with 18f8722.

The 18F8722 has built-in hardware support for an external parallel ram.
You should study how to do it that way.

From the 18F8722 data sheet:
Quote:

7.0 EXTERNAL MEMORY BUS
The External Memory Bus (EMB) allows the device to
access external memory devices (such as Flash,
EPROM, SRAM, etc.) as program or data memory. It
supports both 8-bit and 16-bit Data Width modes and
four address widths from 8 to 20 bits.
Note: The External Memory Bus is not imple-mented
on PIC18F6527/6622/6627/6722
(64-pin) devices.

7.2.1 21-BIT ADDRESSING
As an extension of 20-bit address width operation, the
External Memory Bus can also fully address a 2 Mbyte
memory space.
assaad



Joined: 09 Dec 2009
Posts: 37

View user's profile Send private message

PostPosted: Thu Aug 26, 2010 8:53 am     Reply with quote

Thank you.
It is ok now, there was problem in the address.
I could not use the hardware one because I am using the ports for other issue. Software one save pin for me. However its ok now.
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