Subject:
|
Re: analog encoders
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Tue, 14 Apr 1998 06:15:41 GMT
|
Original-From:
|
Ken Bullis <kbullis@aimnet#avoidspam#.com>
|
Reply-To:
|
kbullis@!StopSpammers!aimnet.com
|
Viewed:
|
1503 times
|
| |
| |
MAR ERICSON wrote:
> Hi, when I compile fencdr0.asm, I get
> "xxxjunk.c"(68): Warning --- Value Truncated
> "xxxjunk.c"(70): Warning --- Value Truncated
> "xxxjunk.c"(68): Warning --- Value Truncated
> "xxxjunk.c"(70): Warning --- Value Truncated
Mar,
I ran into these warnings when I was modifying sencdr0.asm.
They do in fact show a bug in the assembly code, but it's
harmless. If you like gory details, here they are:
Near the beginning, the file defines these constants:
BASE EQU $1000
ADCTL EQU $1030 ; A/D Control/status Register
BASE is the base address of the block of Handy Board registers;
ADCTL is the address of the A/D control register.
Later, to clear this register, the code does this:
LDX #BASE
LDAA #0
STAA ADCTL,X
This loads the X index register with the base address and the A
register with zero, then stores the A register into an address which
is offset from the value of the X register. The programmer gives
ADCTL as that offset, *but the instruction only allows a one-byte
offset.* So instead of storing into $2030 (1000+1030), which is
what was asked for, the assembler truncates the offset to one byte
($30) and stores into $1030, which is what is wanted.
You can safely remove the upper byte from ADCTL (and ADR1), or you
can leave well enough alone and live with the warnings, as I did.
Ken Bullis
kbullis@aimnet.com
|
|
1 Message in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|