![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Guest
|
PIC18F87J50 and External Memory |
Posted: Mon Oct 20, 2008 3:05 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Tue Oct 21, 2008 6:35 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Oct 21, 2008 11:41 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Wed Oct 22, 2008 12:23 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Oct 22, 2008 12:28 am |
|
|
I don't trust addressmod, so I'm not going to test your code.
Someone else can help. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|