Sign in

username:

password:



Not a member?

Search 68hc12



Search tips

Subscribe to 68hc12



68hc12 by Keywords

68HC1 | 812A4 | 9S12DP256 | Bootloader | CodeWarrior | D60A | Debugger | DP256 | ECT | EEPROM | EVB | Flash | HC1 | HCS12 | I2C | IAR | ICC1 | Interrupts | LCD | M68KIT912DP256 | MC9S12DP256 | MC9S12DP256B | Metrowerks | Motor | MSCAN | Multilink | PLL | Quadrature | SDI | SPI | Transceiver | XFC


Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | 68HC12 | Challenge: Why did my code bug out? :)

Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).

Challenge: Why did my code bug out? :) - nixknacks - Nov 1 4:03:59 2008

Hey everyone. I write code for an introductory programming course
using microcontrollers.

I wrote some code for an address book of sorts. In the code, I
declared a variable...

char names[10][16]={" ",....};

The rest of my code consisted of different ways to access, edit and
display the entries, etc.

FACTS:
1. The code compiled without a problem.
2. My code was well under the size limit imposed by codewarrior
(uggg...codewarrior)

PROBLEM:
The code wouldn't work at all! I walked the code through the
debugger, and it wouldn't even enter my main function.

TEMPORARY FIX:
I found that my code worked flawlessly if I redefined my variable
as...

char names[10][8]={" ",....};

DISCUSSION:
The only thing I can think of is that somehow the board could not find
a contiguous 160 Bytes to store my original 2d array. What do you all
think of this hypothesis?

EXTRA INFO:
Using HCS12DG256B
Using Serial Monitor
PS: I'm a graduate student in mechanical engineering. I have a
limited background in programming, but I seem to be a natural...as it
were. I'm really interested in learning more about the memory models
used on the HCS12(X) series...if anyone could point me to a good
source or give me some pointers to help me understand the manual (it's
a little confusing and all this learning gets crammed into my free
time...as if I had any of that!)

------------------------------------



(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )


Re: Challenge: Why did my code bug out? :) - yoanp - Nov 4 0:57:29 2008

--- In 6...@yahoogroups.com, "nixknacks" wrote:
Hi,
See comments below:

>
> Hey everyone. I write code for an introductory programming course
> using microcontrollers.
>
> I wrote some code for an address book of sorts. In the code, I
> declared a variable...
>
> char names[10][16]={" ",....};
>
> The rest of my code consisted of different ways to access, edit and
> display the entries, etc.
>
> FACTS:
> 1. The code compiled without a problem.
> 2. My code was well under the size limit imposed by codewarrior
> (uggg...codewarrior)
>
> PROBLEM:
> The code wouldn't work at all! I walked the code through the
> debugger, and it wouldn't even enter my main function.
>
> TEMPORARY FIX:
> I found that my code worked flawlessly if I redefined my variable
> as...
>

I think it's an initialization problem; depending on what you intend
to do, you can write:
char names[10][8]={0x0}; // and write an initialization function
or
char *names[10][]={"Anne","Helen", "Madonna", char *(null)};
> char names[10][8]={" ",....};
>
> DISCUSSION:
> The only thing I can think of is that somehow the board could not find
> a contiguous 160 Bytes to store my original 2d array. What do you all
> think of this hypothesis?
>

When something goes wrong, you must have some 'crisis solution' - the
best one is to use another compiler or, better, when you know that
algorithm/function you try does not use at all the real world (i.e.
you don't use ADC, PWM, timers, toggling pins) develop that particular
algorithm/function using a general purpose compiler. I can suggest
Borland Turbo C++ 1.0, Mingw+Eclipse or Visual Studio Express C++.
Once the algorithm works OK, then move to the target compiler and
recompile. If something goes wrong, you must be prepared to dig deep
down into disassembled list of that module, but at lest you know that
the difference comes from that particular compiler.

> EXTRA INFO:
> Using HCS12DG256B
> Using Serial Monitor
> PS: I'm a graduate student in mechanical engineering. I have a
> limited background in programming, but I seem to be a natural...as it
> were. I'm really interested in learning more about the memory models
> used on the HCS12(X) series...if anyone could point me to a good
> source or give me some pointers to help me understand the manual (it's
> a little confusing and all this learning gets crammed into my free
> time...as if I had any of that!)
>

Try step by step by asking specific questions...
Regards,
Ioan

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )