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

PIC18F87J50 and External Memory

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








PIC18F87J50 and External Memory
PostPosted: Mon Oct 20, 2008 3:05 pm     Reply with quote

I have tried to enable the external bus of PIC18F87J50 but I have found a problem. I can't use fuses EMCU16 and EASHFT. It's not recognised by the compiler.
I think this is a bug in the configuration manager of CCS. How can I resolve this problem ?

Thanks in advance.

Cris
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 20, 2008 3:22 pm     Reply with quote

See these posts. They have sample code which shows how to use the
#rom statement to set the Config Bits if the desired #fuses statements
are not supported, or if they have bugs:
http://www.ccsinfo.com/forum/viewtopic.php?t=32323&highlight=fuses+rom
http://www.ccsinfo.com/forum/viewtopic.php?t=32323&highlight=fuses+rom
Guest








PostPosted: Tue Oct 21, 2008 6:35 am     Reply with quote

I have use #rom and now the configuration it's ok but if i use the function
Code:

void readextram(int32 addr, int8 *rams, int8 bytes)
{
  read_external_memory(addr, rams, bytes);   
}

void writeextram(int32 addr, int8 *rams, int8 bytes)
{
   write_external_memory(addr, rams, bytes);   


addressmod(extram, readextram, writeextram, 0x20000, 0x2FFFF);

   
setup_external_memory(EXTMEM_BYTE_WRITE | EXTMEM_WAIT_0);

I can't access to external memory, I have check with oscilloscope the signal and no bus activity.
I have build a simple program with Microchip C18 and I can access to the external ram.
How I can solve this problem?

Thanks

Cris
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Oct 21, 2008 11:41 am     Reply with quote

1. I wouldn't use addressmod. It's buggy.

2. Post your compiler version.

3. Post a very short program that calls the external memory functions.
The program must be compilable without errors. It must have
#include, #fuses, #use delay(), #use rs232() and main() statements.
It should display the value that was read from external memory.

You can probably do this in about 10 lines of code. Don't post 50 lines.
Guest








PostPosted: Wed Oct 22, 2008 12:23 am     Reply with quote

compiler version 4.075.

Source Code

H File
Code:

// MAIN.H
#include <18F87J50.h>

#FUSES H4_SW, PLL3, NOCPUDIV, EMCU20, EASHFT


C File

Code:


#include "main.h"

#use delay(clock=48000000)

void readextram(int32 addr, int8 *rams, int8 bytes)
{
   read_external_memory(addr, rams, bytes);   
}

void writeextram(int32 addr, int8 *rams, int8 bytes)
{
   write_external_memory(addr, rams, bytes);   


addressmod(extram, readextram, writeextram, 0x20000, 0x2FFFF);

void main(void)
{
   unsigned char x;
   unsigned char extram p[20];
   unsigned char rd;
   
   setup_external_memory(EXTMEM_BYTE_WRITE | EXTMEM_WAIT_0);

   
   for (;;)
   {
      for (x = 0; x < 10; x++)
         p[x] = 0xA5;

      for (x = 0; x <10; x++)
      {
         rd = p[x];
         if (rd == 0xA5)
            rd = 0;
      }   
      delay_ms(100);
   }
}



This my test code.

Cris
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Oct 22, 2008 12:28 am     Reply with quote

I don't trust addressmod, so I'm not going to test your code.
Someone else can help.
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