Subject:
|
RE: SENSOR_READ doesn't return 0
|
Newsgroups:
|
lugnet.robotics.rcx.pbforth
|
Date:
|
Thu, 15 Apr 1999 17:21:29 GMT
|
Viewed:
|
1785 times
|
| |
| |
> ..and now I have the answer, after extensive grepping around Kekoa's
> disassembly and the pbFORTH .ASM files.
>
> SENSOR_READ should return only the bottom byte, the call to 0x14C0 only
> returns a byte so the high byte contains garbage (actually it seems to be
> the high byte of the raw sensor word, which is why I was getting 0x300 and
> 0x200 returned). In raw mode SENSOR_RAW and SENSOR_VALUE return the same
> thing.
>
> For the moment I have recoded LIGHT? and it works:
>
> : LIGHT? ( sensor -- value )
> BEGIN
> DUP SENSOR_READ
> FF AND 0=
> UNTIL
> SENSOR_VALUE
> ;
>
> I think SENSOR_READ read should end with:
> MOV.B r6l,rTOSl ; Put result on top of stack
> or whatever, I don't know this assembler. I guess the high byte should be
> set to zero also.
> --
John,
Thanks a lot for this catch. Sounds a lot like the email I exchanged with
Kekoa regarding power down mode and external stacks, but that's another story...
Cheers,
Ralph Hempel - P.Eng
--------------------------------------------------------
Check out pbFORTH for LEGO Mindstorms at:
<http://www.bmts.com/~rhempel/lego/pbFORTH/default.html>
--------------------------------------------------------
Reply to: rhempel at bmts dot com
------------------------------------------------------
|
|
Message has 1 Reply: | | Re: SENSOR_READ doesn't return 0
|
| Actually, whils I am re-coding things, is there any reason why you didn't do DELAY like this? : DELAY ( 100msec timer -- ) 0 OVER TIMER_SET SWAP ( timer ticks ) BEGIN OVER TIMER_GET OVER > ( timer ticks time>ticks ) UNTIL 2DROP ; I have produced an (...) (26 years ago, 15-Apr-99, to lugnet.robotics.rcx.pbforth)
|
Message is in Reply To:
| | Re: SENSOR_READ doesn't return 0
|
| ..and now I have the answer, after extensive grepping around Kekoa's disassembly and the pbFORTH .ASM files. SENSOR_READ should return only the bottom byte, the call to 0x14C0 only returns a byte so the high byte contains garbage (actually it seems (...) (26 years ago, 13-Apr-99, to lugnet.robotics.rcx.pbforth)
|
10 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|