Go to Post We may be changing cheese heads for cheesy poofs, but in the imortal words of Gen. MacArthur "we shall return" (team # 2437) - cdebo [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 04-12-2004, 00:51
scitobor 617's Avatar
scitobor 617 scitobor 617 is offline
More nerd than you can handle!
AKA: Alan Meekins
FRC #0617 (HSHS 617 "DUKE")
Team Role: Programmer
 
Join Date: Nov 2003
Rookie Year: 2003
Location: Richmond, VA
Posts: 153
scitobor 617 will become famous soon enoughscitobor 617 will become famous soon enough
Send a message via AIM to scitobor 617
Re: Arrays on the PIC?

Quote:
Originally Posted by Mark McLeod
An array of rom constants (those that use program space) can be larger, but can't be modified at run time.
That is perfect for what I am writting. I plan to place a maximum of 240 bytes into an array. The values will not change once the program as been written.

Thanks for the help.
__________________
Beta testers needed!
http://www.nullagent.no-ip.com

Your kidding, there are other operating systems besides Linux?!
  #2   Spotlight this post!  
Unread 05-12-2004, 17:36
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Arrays on the PIC?

Quote:
Originally Posted by scitobor 617
I plan to place a maximum of 240 bytes into an array.
Just wanted to mention that while single dimension arrays work as expected, there are some oddities in the mcc18 implementation of C with multi-dimensional arrays, e.g., char abc[10,5]. Especially, differences between how a multi-dimensional array behaves in rom vs. in ram space when passed by address to another routine. If you plan on doing this I suggest experimenting first with a test program.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #3   Spotlight this post!  
Unread 05-12-2004, 19:24
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Arrays on the PIC?

Quote:
Originally Posted by Mark McLeod
Just wanted to mention that while single dimension arrays work as expected, there are some oddities in the mcc18 implementation of C with multi-dimensional arrays, e.g., char abc[10,5]. Especially, differences between how a multi-dimensional array behaves in rom vs. in ram space when passed by address to another routine. If you plan on doing this I suggest experimenting first with a test program.
Mark,

I used multidimensional arrays in ROM space with no issues. I address the array by pointer reference and index from there.

I don't have any arrays in RAM space so I can't speak to that... Are you dynamically allocating storage or anything strange like that?
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #4   Spotlight this post!  
Unread 05-12-2004, 21:27
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Arrays on the PIC?

Quote:
Originally Posted by Mike Betts
Are you dynamically allocating storage or anything strange like that?
Hi Mike,
I also use multi-dimensional arrays without problems, however, my main programmer coded an algorithm Fall 2003 using a multi-dimensional array in ram to empirically develop some constant values. When he simply changed the declaration to rom after fixing his constants the code choked. No dynamic allocation of memory (especially since it was in rom ).

I don’t remember the details (it was almost a year ago), and don't think those details are germaine to poor scitobor here. When I debugged the problem I did change how his code used pointer arithmetic, but only because his particular application ran into an odd compiler bug. It generated incorrect assembly (no he wasn’t optimizing – I knew you guys reading this were thinking that). It’s probably gone from the latest version shipped with the KOP this year.

Hence the caution and suggestion that one might benefit from testing a simplified skeleton of an algorithm using rom multi-dimensional arrays. I consider that good practice for the students in any case.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 05-12-2004 at 21:31.
  #5   Spotlight this post!  
Unread 05-12-2004, 22:15
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Arrays on the PIC?

Two possibilities come to mind. Your student may have been using a byte index in RAM and did not change it to a word for ROM. The other is that, if he or she was using pointers, the pointer had to change to ROM CONST also...

At any rate, it sounds like a moot point now. If anyone else has problems, let us know...
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #6   Spotlight this post!  
Unread 06-12-2004, 09:10
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Arrays on the PIC?

Quote:
Originally Posted by Mike Betts
Two possibilities come to mind. Your student may have been using a byte index in RAM and did not change it to a word for ROM. The other is that, if he or she was using pointers, the pointer had to change to ROM CONST also...

At any rate, it sounds like a moot point now. If anyone else has problems, let us know...
Both suggestions are possible. It only took 5 minutes to debug which is why I don't remember the details, just that it occurred. I was helping him fix other errors at the same time, too. It's the kind of thing that can drive a student bonkers, but is just fun for us mentors.

I have on my "to do" list an off-season debugging workshop where the more advanced student programmers have to find what's wrong with a collection of misbehaving projects and code ranging from obvious MPLAB issues to subtle code problems.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 06-12-2004 at 09:18.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
pic: 294's First Inventor Robot (pic 1)... CD47-Bot Robot Showcase 4 10-03-2004 19:34
pic: pic 1 CD47-Bot Robot Showcase 6 22-02-2004 00:29
TCP/IP on a PIC Venkatesh Electrical 1 18-11-2003 21:00
pic: Another pic of Team 930 CD47-Bot Robot Showcase 7 25-02-2003 21:07


All times are GMT -5. The time now is 21:56.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi