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

Struct on the dSPIC...Help!

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



Joined: 06 May 2007
Posts: 35

View user's profile Send private message

Struct on the dSPIC...Help!
PostPosted: Sun Mar 02, 2008 9:51 am     Reply with quote

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 Rolling Eyes

Sorry for my english
Thanks

Bye
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Mar 02, 2008 1:11 pm     Reply with quote

Most of us have not bought the dsPIC compiler. It's very expensive and
it's very new. That's why questions about dsPIC don't get many answers.
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