To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 3359
3358  |  3360
Subject: 
Re: Programming in Assembly
Newsgroups: 
lugnet.robotics.rcx, lugnet.robotics.rcx.legos
Date: 
Fri, 18 Jul 2003 04:40:50 GMT
Viewed: 
143 times
  
Ok, the motor stuff makes sense, I got a little confused with the shift thing. I looked at the proggamming manual some more and it explaned the @ (Register inderect) but I don't see why it is needed, also in you example you specify the data as #0x02, why isn't it #0x02:8 (how the manual says to do data)?

As for Sensors I was able to find (I think) how to work it:
in the h8300.rcx file (no idea what this is for) I found the addresses of the sensor ports (0xe0,0xe2 and 0xe4)

to make unactive run 'bclr r6l,@0xbb:8'
to activate run  'bset r6l,@0xbb:8'
where r6l contains the the value for the correct sensor out
(I'm guessing 0 for sensor 1, 1 for sensor 2 and 2 for sensor 3?)
Then after that I need to waste around 32 states and make it unactive and then to read it i do
   mov.b @0xe8:8,r6h
   or.b  r6l,r6h
   mov.b r6h,@0xe8:8
and activate it again when I'm done?
If this is correct please explain what the last two lines do, I just blindly copied them from the brickos kernel

Also once I have a program written can I just assemble it with binutils and then use dll to download it to the rcx? Do I need to specify where it will be loaded to at the begginining of my program? Do I need to write code to deal with the on and off buttons or does the rcx take care of that for me? Another thing, do I need to worry about resetting the watchdog timer?

and once I finally do get my program writen how do I assemble it? what command do I use, I have the cross compiler and binutils set up for my legos installation.

Thanks,
Aaron


On Thu, 17 Jul 2003 02:49:44 GMT
"Mark Riley" <markril@hotmail.com> wrote:

"Aaron Goodman" wrote:

I was able to find the doc here:
http://www.renesas.com/avs/resource/japan/eng/pdf/mpumcu/e602025_h8300.pdf

Yep, but you will also need the User's Manual (at the URL I
mentioned previously) that describes the on chip I/O features
of the H8 if you plan on doing any work with the sensors.

your post about the motor seems helpful, so if I understand right the way • to
run motor A forward would be
"mov 0x030003,r0h
mov 0x80,r0h"
and for the motor C the same except 0x06?
How does the instruction get to the motors? is there a sepearte routine • that
needs to be run to do this or is it taken care of by the ROM?

To turn on motor C forward you would do this:

  mov #0x02,r0h
  mov r0h,@0x80:8

The second instruction writes the value to the motor control
register (described at Kekoa's RCX Internals).  Here's
another example:

  ; A: reverse, B: float, C: forward
  mov #0x42,r0h
  mov r0h,@0x80:8

also I was a little confused by the @ signs in the c code of legos can • someone
explain these to me?

Do you mean in the asm code?  The @ signs are used in
the source or destination operand of an instruction to refer
to a memory location.  I think this is probably covered in
the Programmer's Manual you mentioned above.

When I was looking at the brickOS code for dsensor.h I noticed a command • "beq"
which I coudn't find in the documentation for the chip. What is this?

Look under the instruction group labeled "Bcc" in the Programmer's
Manual.  This is a conditional branch instruction (in this case, branch
if the zero flag is set).

Cheers,

Mark








Message has 1 Reply:
  Re: Programming in Assembly
 
(...) (how the manual says to do data)? That's because I don't like to type more than is necessary! :-) Take this line for example: mov.b #0x02:8,r0h This line is doubly redundant. The destination operand is an 8-bit register so the other qualifiers (...) (21 years ago, 18-Jul-03, to lugnet.robotics.rcx, lugnet.robotics.rcx.legos)

Message is in Reply To:
  Re: Programming in Assembly
 
(...) mentioned previously) that describes the on chip I/O features of the H8 if you plan on doing any work with the sensors. (...) to (...) that (...) To turn on motor C forward you would do this: mov #0x02,r0h mov r0h,@0x80:8 The second (...) (21 years ago, 17-Jul-03, to lugnet.robotics.rcx, lugnet.robotics.rcx.legos)

9 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
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR