Kova
Joined: 06 May 2007 Posts: 35
|
Struct on the dSPIC...Help! |
Posted: Sun Mar 02, 2008 9:51 am |
|
|
Hi all,
I have posted some days ago a post in the "PIC24/dsPICĀ® Compiler Comments" section but I haven't still resolved my problem :(
I have some problems with DSPIC30F4013 (also tried with 24FJ128GA010) and the structs :(
This is a piece of my code:
Code: |
#include <30F4013.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES FRC //Internal Fast RC Oscillator
#FUSES NOCKSFSM //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES WPSB16 //Watch Dog Timer PreScalar B 1:16
#FUSES WPSA512 //Watch Dog Timer PreScalar A 1:512
#FUSES NOPUT //No Power Up Timer
#FUSES NOBROWNOUT //No brownout reset
#FUSES BORV47
#FUSES LPOL_HIGH //Low-Side Transistors Polarity is Active-High (PWM 0,2,4 and 6)
#FUSES HPOL_HIGH //High-Side Transistors Polarity is Active-High (PWM 1,3,5 and 7)
#FUSES NOPWMPIN //PWM outputs drive active state upon Reset
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOCOE //Device will reset into operational mode
//#FUSES ICS0 //ICD communication channel 0
#FUSES RESERVED //Used to set the reserved FUSE bits
#use delay(clock=8000000)
struct codeElement {
long on;
long off;
} const Table[] = {
{ 55, 0 },
{ 273, 92 },
{ 46, 92 },
{ 46, 46 },
{ 46, 46 },
{ 138, 135 },
{ 46, 46 },
{ 46, 46 },
{ 46, 46 },
{ 46, 46 },
{ 46, 46 }
.....//big Table
};
void main{
.....
int i =0;
while (Table[i].on != 0) //Here crash!
{
cTest = (Table[i].on);
.....
}
|
I have tested with Proteus and I receive "Illegal data memory access" error :(
I have tested with MPLAB SIM and it crashs and it gives me these errors :(:
Code: | CORE-E0004: Trap due to unimplemented FLASH memory access, occurred from instruction at 0x000100
CORE-E0004: Trap due to unimplemented FLASH memory access, occurred from instruction at 0x000102
CORE-E0004: Trap due to unimplemented FLASH memory access, occurred from instruction at 0x000104
CORE-E0004: Trap due to unimplemented FLASH memory access, occurred from instruction at 0x000106
CORE-E0004: Trap due to unimplemented FLASH memory access, occurred from instruction at 0x000108 |
Also, I have putted the struct in RAM with this code:
Code: | struct codeElement {
int on;
int off;
} Table[] = {
{ 55, 0 },
{ 273, 92 },
{ 46, 92 },
{ 46, 46 },
{ 46, 46 },
{ 138, 135 },
{ 46, 46 },
{ 46, 46 },
{ 46, 46 },
{ 46, 46 },
{ 46, 46 }
.....//big Table |
But same problems :(
P.S.
I'm using CCS 4.068 version and the same code works perfectly on a PIC18F2550
Sorry for my english
Thanks
Bye |
|