Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Array Definition Problem

Status
Not open for further replies.

apsua

Member level 3
Joined
Feb 13, 2015
Messages
62
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Activity points
538
Hello,
I am using CCS C. I have an interesting problem. Maybe I miss something. I am defining an array as below:

Code:
#define	SETTING_LANGUAGE_MIN					0
...
...
#define	SETTING_WAIT_LOCK_TIME_MIN				0
...
...

int minConfigurations[]							= {SETTING_LANGUAGE_MIN,
										...,
                                                                                ...,
										SETTING_WAIT_LOCK_TIME_MIN,
                                                                                ...,
                                                                                ...
												};

When I define the array as above, the SETTING_WAIT_LOCK_TIME_MIN index is assigned as 0x0C. And some of the rest of the indexes are also not correct. If I define the SETTING_WAIT_LOCK_TIME definition as 1, now it and the rest are assigned correctly.
What is the problem here?
Thanks.
 

I see no problem except possible incorrect array type choosen. 'int' is signed 16 bit value. May be byte type will fit better.
 

I tested by defining int8 now, no change.
 

I had tested on the hardware at first, when I saw the problem, I tested it on Proteus, and saw that the array cant be assigned correctly.
 

You said nothing. Did you seen what exactly values stored in array in debug mode?
 

The minConfiguration array's memory addresses are 0x103-0x113. The incorrect assign is at 0x10B. I put an "on change" condition on Proteus to the address 0x10B. As the simulation starts the 0x10B address is assigned as 0x0C. Up to this address, the previous indexes are correctly assigned.
Now, I had to clear that definition of array, and I defined the array[MAX_INIT_NO], then in the software I assigned one by one.
 

If you are interested in a serious answer, post a minimal CCS design that allows to reproduce the problem, along with compiler version information. Otherwise keep on guessing.

I would generally suggest to check the code in MPLAB SIM rather than Proteus.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top