Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Having trouble debugging a piece of code.

2005-02-07 by Jose Fuentes

Some comments:

//why do you declare TargetPointer as const?
volatile const uint8_t * TargetPointer;

//try this instead of using TempPointer, TargetPointer
switch (Room1[0]) 
//also, don't forget the 'break' sentence after
//every case block

Regards

Jose

 --- wbounce <wbounce@safeplace.net> escribió: 
> 
> I am having trouble debugging a piece of code that
> used to work. I using
> avr-gcc (GCC) 3.4.1 with AVR Studio 4.10.356 as my
> debugging tool
> dwarf-2. I have the following code which is not
> working. The listing
> shows Room1 as it should but in AVR Sutdio it does
> not show up correctly
> and hence my switch code fails. What actually shows
> in the Room1 array
> varies greatly. Something it looks like all 0s
> sometimes it looks like
> wide characters ie a letter followed by a 0. what am
> I doing wrong. I
> know I had this code working fine a couple of weeks
> ago before my
> Hbridge problems. I had single stepped through all
> of it and then
> pointer was working fine.
> 
> volatile const uint8_t * TargetPointer;
> 
> #define TARGET_FLFLB 25
> #define TARGET_LFLB 24
> #define ACTION_STRAIGHT 70
> #define ACTION_TURNRIGHT 65
> #define ACTION_STOP 68
> 
> const uint8_t Room1[] ={
> ACTION_STRAIGHT, 
> TARGET_FLFLB,
> ACTION_TURNRIGHT,
> TARGET_LFLB,
> ACTION_STOP,
> };
> 
> uint8_t TempPointer;
> 
> TargetPointer = &Room1[0];
> TempPointer = *TargetPointer;
> switch (TempPointer) 
>   do code based on action
> 
> 
> --listing
>   17               	.Ltext0:
>   18               	.global	Room1
>   19               		.data
>   22               	Room1:
>   23 0000 46        		.byte	70
>   24 0001 19        		.byte	25
>   25 0002 41        		.byte	65
>   26 0003 18        		.byte	24
>   27 0004 4A        		.byte	68
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
>     AVR-Chat-unsubscribe@yahoogroups.com
> 
>  
> 
> 
> 
>  


	

	
		
___________________________________________________________ 
250MB gratis, Antivirus y Antispam 
Correo Yahoo!, el mejor correo web del mundo 
http://correo.yahoo.com.ar

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.