Programming Hints


Why do I Get "Unknown Instruction"
If you get "Unknown Instruction" Displayed in the Motorvator Communications Window (the black window with green writing), then it means that the Motorvator doesn't understand how to interpret the next instruction in your program.

There are two likely causes:

1. If you use MeccCompiler 3.0.9 (find the version under Help>About)

Open in new window

then it can make instructions that older Motorvators (running AWOS 2.23 - check this by typing H - for Help at the Command Prompt) can't understand.

The most common one (and one that will be compiled in the first few lines of your program) is that V3.0.9 uses a SET BYTE instruction to assign an initial value to a variable. V2 uses MOVE BYTE.

Use MeccCompiler 2.0.131 with AWOS 2.23 and 3.0.9 with AWOS 2.35.

If in doubt, use Compiler 2.0.131. It will work with both AWOS types, but obviously you won't be able to use the new instructions.

2. Your program is trying to execute the next instruction from an incorrect address.

This is most probably because your program has messed up the Stack by executing an odd PUSH or POP instruction.

How do I make the Director "Centre Off band" Wider?
Q. When using the Director controller, there is a "Centre Off band" when the stick is centred, where the motors are stopped. How can I make this "centre off band" wider so it is easier to operate my model?

A. The pre-programmed Modes 1 to 6 have a default band of 10% of the full movement as "centre off". You can load your own program and increase this.
On the CD in the CANNED MODE directory is a file called "modes 1 to 6.txt". This is the source code to replicate all 6 modes.
If you compile and download this to the MotorVator, then you will get new programs 91 to 96, with the same functions as modes 1 to 6.

Here is part of the code


Begin Program

Declare Byte    Direction            ;  to receive readings from Joystick
Declare Byte    Speed
Declare Byte    Button_State        to receive reading from Button
Declare Byte    ChosenMode

firstlycalibrate the joystick to set the centre position and define a deadband around this centre position

Calibrate Joystick    1

Calibrate Joystick    2

now select which mode (91 through 96)

ChosenMode GetProgramNumber()

Select Case ChosenMode

    Case 91    
            Call Mode1
            Call Mode2
            Call Mode3
            Call Mode4
            Call Mode5
    Case Else    
Call Mode6()

End Select

End Program

The two code lines:

Calibrate Joystick    1,10,10
Calibrate Joystick    2

indicate that the "centre off band" should be 10% for the X and Y directions on both joysticks. To change to band to 30%, change the lines to

Calibrate Joystick    1,30,30
Calibrate Joystick    2

then compile and download. You can make the "Centre off Band" as big as you want. E.g if you used say a value of 80, then the motors would only start at the very end of the joystick travel (but they would be either full On or Off - you would lose the proportional control).

Don't forget to fit the Program Memory Backup Battery! 1 to 6.txt