The MarineBot User Guide

The NorseBridge™ CMDR™ is an android app that controls and programs the CMDO™ micro-controller board. This app enables anyone with an android phone to remote control the MarineBot and reprogram it to perform more functions. It’s an educational tool that teaches a person about micro-controllers and assembly language in a fun and enjoyable way.

Download and Install the App
The app comes in the form of an “apk” file. Use your phone’s browser and Download it here: “https://norsebridge.com/downloads/”.
Because the download is free and not from an App Store, your phone will offer a caution and ask you to confirm. The authentic CMDR™ app is only available from NorseBridge.com, a secure site. After the download is complete your phone will ask if you wish to open and install it. Click install and run the app. The app needs to be installed to continue following this guide.

App Permissions – Storage
Saving and loading program files is the main function of the app, so giving it storage permission is necessary.

  • Open the Control panel
  • Open “Apps & Notifications”
  • Select the CMDR™ app
  • Look for “Permissions”
  • Enable “Storage”

The Title Bar Menu

The menu bar has 4 icons that navigate the pages of the app

The Control icon: The control screen is also the startup screen

The Download icon: The download page of NorseBridge.com

The Program icon: Opens the programming screens

The Bluetooth icon: Establishes a connection to the CMDO™
Take a moment to navigate all the Title menus and sub-menus.

Establish a Bluetooth Connection

  • Click the Bluetooth menu icon and select “Pair a New Device”

  • Search for a new device to pair to.
  • The CMDO™ bot should appear like this:
    • CMDOxx (xx=2 hex digits)
    • Be sure your bot is turned on
    • It takes a minute for your phone to find it
  • Select the CMDOxx and enter “1234” as the pin.
  • After pairing, hit the back arrow to return to the app.
  • Click the Bluetooth icon again and select “Connect a Paired Device”

  • Click on the paired CMDO™ in the list
  • When connected, the blue led will stop blinking.

Controlling the MarineBot

  • B20 Controls the Laser
    • touch the button and slide right – look for “1”
    • touch again and slide left- look for “0”
  • B25 Turns the Beeper On and Off
    • touch B25 and slide right – look for “1”
    • B35 controls the pitch
    • slide your finger back forth on B35
    • touch B25 and slide left- look for “0”
  • Control the motors
    • B10 is labeled fwd – slide up/dwn
    • B11 is labeled stp – touch B11 to stop
    • B12 is labeled rev – slide up/dwn
    • Notice the speed tracks the hex number
    • Repeat on the right side
    • Buttons only work one at a time. Be sure to lift your finger off the screen to use another button.
  • B24 Plays the Marine Hymn
    • Touch B24
    • Allow it to play to the end
    • Note how all the functions are under program control
      • A programmed timer controls the tempo
      • The beeper changes with the tempo to play the melody
      • The motors stop and start in tempo
      • And the laser blinks on and off with the notes
    • Once you learn to program you can do your own song and dance

CMD and ARG: The Control Codes
When you press and slide a button BlueTooth sends 2 numbers or codes to the micro-controller. The first code is the button id, which is a column-row indicator. Button 24 is column 2 row 4, for example, and the code 0x24 is sent (0x means hex). The second code is the sliding value of the button. These 2 codes are the command and argument.

“CMD” and “ARG” are used as abbreviations. When you write a program it’s up to you to interpret these 2 codes and decide what to do. These 2 variables are constantly changing as buttons are used.

There are 18 “CMDs”on the control screen to use and each “ARG” can have any value between 0 and 255 in decimal (0x00 to 0xFF in hex). You can limit the range to less than this maximum if you choose.

If you are not familiar with hex it’s short for hexadecimal – a number system that has 16 characters (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F). Hex is a human readable way to express a 4-bit binary number. 8 bits let a computer store a number from 0 to 255 (in decimal terms). But a string of 8 bits is hard for a person to read. So the Hex format was created as a short hand for a string of bits. “0000 0000” to “1111 1111” in binary is represented as “00” to “FF” in hex and 0 to 255 in decimal.

In decimal it’s not customary to display a place holder with the value 0 but in binary and hexadecimal it is. The reason is because decimal is typically used to count but binary and hex are typically used as codes. However, they can also be used to count – the programmer decides.

The “CMD” is necessary to send a command to a program. The “ARG” is not strictly required. Though it is sent, it it does not have to be used.

Edit the Control Buttons

  • Under Program icon, navigate to the Button Labels

  • Click the Left “Fw” button
  • Change the “Slide Range – Begin” to “3F”

  • Change the “Slide Range – End” to “7F”

  • Click OK/SAVE

  • Navigate back to the Control Screen and try out the change
  • Notice how the motor speed is limited by the numeric range
  • Try a few changes of your own to get the hang of it
    • Change a button label: Make B20 “laser”, B25 “beep”, B35 “pitch”, and B24 “marineHymn”
    • Display a decimal number instead of hex
    • Display a binary number instead of hex

Run The DEMO_LOOP

  • Select “Sub-Program” from the programming menu
  • Select the “Launch” menu then Demo Loop

  • The Demo Loop comes programmed to blink the laser twice
  • The Demo Loop runs continuously
    • Select Launch then Command Loop
    • Or select CMDO™ Reset
    • Or select About CMDO™
    • Any of the above will exit the Demo Loop
  • Notice how the word “Loop” has real meaning
  • It will loop forever unless told to stop
  • The DEMO_LOOP and CMD_LOOP can’t run at the same time. So, when you enter the CMD_LOOP the DEMO_LOOP stops. The Command Loop processes commands from the control screen. So unless you’re pushing buttons, the bot typically doesn’t do anything.

Locate the DEMO_LOOP in the Program List and open it for editing.

Re-program the DEMO_LOOP

  • The purpose of the Demo is to try out new ideas
  • Edit line 1 of the program:
    “0380; DEMO_LOOP; 3002 MOVLW 0X02; W=02h or 2d”

    • Select the MOVLW command

    • Select the “User Defined Byte”

    • Select bit0 and bit1 which totals 3

    • Select Enter twice to accept the change
  • Select the “Prog” menu and select “Program File”

  • “Get CMDO™ Check Sum” is used to verify the bot program
  • Now run the Demo Loop and confirm it blinks 3 times
  • Try different numbers to get better at using the editor


The Total Commander App
Total Commander is a file manager for the Android phone. It is a free down load from Google Play. The similarity of the name is a coincidence. The name implies that it offers the user total command of the files on their android device. It has an unzip feature which is the main reason we need it. If you have an unzip app on your phone and know how to use it, then you don’t need Total Commander. All the bot programs on NorseBridge.com are only available in zip format. Total Commander can unzip these files. Its apk file is also on the download page. Install it if you don’t have an unzip feature.

The MarineBot Zip File
The MarineBot control program consists of 32 separate sub-programs that work together to bring the MarineBot to life. The sub-programs have already been “burned” into the micro-controller hardware, so once you download the CMDR app you can control the bot. However to read, edit, and change the sub-programs you’ll need to download MarineBot.zip.

Download MarineBot.zip

  • Navigate to the Download screen and click to download MarineBot.zip

  • Open Total Commander and navigate to the Download folder
  • Look for “NorseBridge_download” and click its name (not the icon)

  • It will take you inside a zip archive – look for MarineBot folder
  • Click the MarineBot folder icon and select copy in the menu below

  • It shouldn’t be copied to its current location – navigate to the Download folder and click OK to select the path
  • Click OK to make the copy
  • Navigate up and out of the zip archive back to the Download folder and locate the MarineBot folder.
  • Return to the CMDR™ app.

Make MarineBot the Active Folder

  • Navigate to the Program List
  • Select the top line – it begins: “/storage…
  • Click the double dots “..” to navigate up (it’s a linux thing)
  • Select MarineBot
  • The MarineBot Program listing is now accessable

Change a Sub-program – Notes in the “marine hymn”

  • Select “Program List” from the programming menu
  • Scroll down and find “0600: MarineM1”
  • This is the sub-program that holds the melody of the 1st verse
  • Select this line and “Open file”
  • Select the first line of the program and choose “Edit”

  • Scroll to the top of the list and find “3400; RETLW k;”
  • Select the command and choose “Musical Note Byte”

  • Scroll to the bottom and choose the highest note

  • Click enter to select the byte and again to accept the new command
  • Repeat this edit for the next 2 lines

  • Select the “Prog” menu and select “Program File”
  • Navigate to the Control screen and play the marineHymn
  • Do you hear how the first 3 notes of the melody changed?

Change the Program Back

  • Return to the “Program List”
  • Open the MarineM1 file again
    (The previous changes were not saved on your phone)
  • Select the “Prog” menu and select “Program File”
  • Navigate to the Control screen and play the marineHymn

The MarineBot CMD_LOOP
When bluetooth sends a “CMD” the micro-controller responds by setting the “NewCmd” flag and then jumps to the CMD_LOOP to let the programmer process the command. Bluetooth doesn’t jump to the DEMO_LOOP to process a command. If no new command is received the bot just idles continuously checking/waiting to receive one.

Let’s see what the CMD_LOOP does. It has 7 sub-routines that it calls in turn looking for one to process this new command it just got.

  • Call playMarine at address 0x420
  • Call tuneTmr at address 0x440
  • Call c1_beep_on at address 0x4C0
  • Call beep_arg at address 0x4E0
  • Call motLeft at address 0x500
  • Call motRight at address 0x580
  • Call c7_laser at address 0x420
  • return – to the bluetooth monitor loop

Learn to open each sub-routine file and read it over. Take notice of the return command at the end. Each sub-routine does some processing and returns to the CMD_LOOP which returns to the bluetooth loop.

Each command line in the program executes in 250 nano-seconds that means it processes 4 million commands each second. Oh – it’s fast. Probably the most difficult concept is that the entire CMD_LOOP and its sub-routines execute instantly from a practical point of view. The machine spends nearly all its time waiting. Recall how instantly the pitch changed when you slid that button.

This user guide has given an overview of the MarineBot, the CMDR™, and the CMDO™ and how to use teh controls. The NorseBridge website maintains a blog with details for programming. Begin with the topic “Interpreting Commands” and then take a look at each gizmo, gadget and peripheral. If you take it small bites and try out the examples it’s not so hard to learn.

Suggested Topics

  • “Interpreting Commands”
  • “The I/O Port”
  • “The NCO Peripheral”
  • “The TIMER Peripheral”
  • “The H-Bridge Motor Driver”
  • “Making Music with the CMDO™”