![]() |
Help: Misterious 8292 Bug
Hey,
I was just wondering if something like that ever happend to anybody before and there is already a solution to my problem: What I did was looking at Kevin's Code an stealing the Interpretor Idea but I wrote different function (to make it work with dead raconing just for now) and changed gave the constants different names and so on. Everything worked really good until I tried to add a CMD_DIFFTURN Command to my Library that was supposed to make one Wheel slower in order to turn (instead of reversing them against each other like my CMD_TURN function does). But whenever I use CMD_TURN and CMD_DIFFTURN together my first Command (here CMD_WAIT) gets the VALUE 8292 instead of 1 (#define CMD_WAIT 1). All other Values stay untouched. I was tring arround for nearly the entire day and couldn't figure out why and HOW something like this could happen, but what I found was that this number 8292 is appearing 2 times in the Assembler code which made me somewhat confused ... So my question is did anybody else experience something like this before (maybe with another Value then 8292) or did I discover a new bug / way to trick myself ... Ah and before I forget, I was testing this code withthe EduRC. Code:
#define ROBOT_SPEED 10 |
Re: Help: Misterious 8292 Bug
We need to see more of your code to help locate the problem.
Offhand I'd say you might have an address mapping problem in your code caused by an argument mis-match for instance. A decimal 8292 could be coming from a mis-mapped ASCII text string of "space@", or any of a number of other sources. |
Re: Help: Misterious 8292 Bug
1 Attachment(s)
Okay, here is the source code. If anybody see's what I did wrong that would be really awesome for me. I'll be sry if you'll find out that my mistake is obvious but its the first time I do microchip programming. Anyway, thx to everybody that'll look at it ...
Felix |
Re: Help: Misterious 8292 Bug
I took a quick look and repeated your problem.
It doesn't seem to have anything to do with the CMD_WAIT, because it happens with all NULL cmds as well. Oddly enough, it only happened for me when the number of commands equaled 6 or 7. More or fewer commands didn't have a problem. That's probably because the number of cmds determines the location where the array gets allocated. A quick solution is to pad with NULL cmds as a work around to go on with your testing until the problem is solved. I'll take a look at the corresponding memory map for the problem and see if there's a space allocation issue or memory overwrite from the variables before it. Found it. Your problem is line 15 of robot.c A printf cannot have a format string of more than 80 characters (between the quotes). What's happening is the print buffer is overwriting memory locations that follow it. Depending on how many commands you have in command_list (the length of the array in other words) the linker will fit it in to the most convenient available space. Sometimes this falls after the print buffer. Several other variables are being overwritten as well, you just didn't happen to notice. |
Re: Help: Misterious 8292 Bug
Quote:
And regarding prinft: Is it 80 chars / cycle max or 80 chars / fct call max? Just so I know which limit I got. After that I'll write an Error Handler in the printf class when the string exceeds the 80 sign max ... And one more time, thx!! Felix |
Re: Help: Misterious 8292 Bug
Quote:
You can break up that printf of yours into two printf's and it will work fine. The print_lib.c file has this lurking warning as part of the lead comment block: Code:
* 3. The %s directive only supports a string of 40 bytes and the format stringThat's the safest idea, to modify the IFI printf code to add a check for strings > the limit. We simply truncate the string if it's longer than ifi_printfBufr. |
Re: Help: Misterious 8292 Bug
Quote:
Bye Felix |
| All times are GMT -5. The time now is 02:48. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi