Wiki source code of BASIC Atom Pro Programming Tutorial.
Version 17.1 by Eric Nantel on 2023/01/19 13:20
Show last authors
| 1 | {{html wiki="false" clean="true"}} |
| 2 | <body><table border="0" cellpadding="0" cellspacing="0" > |
| 3 | <tbody><tr> |
| 4 | <td valign="top" align="left" colspan="2"><b><font face="Verdana" size="2">BASIC Atom Pro Programming Tutorial.</font></b> |
| 5 | <p><b><font face="Verdana" size="2">Updated <!--webbot bot="Timestamp" startspan s-type="EDITED" s-format="%m/%d/%Y" -->06/10/2009<!--webbot |
| 6 | bot="Timestamp" i-checksum="12514" endspan -->.</font></b></p> |
| 7 | <p><b><font face="Verdana" size="2">Safety first!</font></b><font face="Verdana" size="2"> Wear eye protection and never touch a powered robot!</font></p> |
| 8 | <p><font face="Verdana" size="2"><b>Note:</b> The purpose of this tutorial is to illustrate how to download a BASIC program onto the BASIC Atom |
| 9 | Pro processor, and test the functionality of the Bot Board II.</font></p> |
| 10 | <font face="Verdana" size="2"> </font></td> |
| 11 | </tr> |
| 12 | <tr> |
| 13 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"> </font></td> |
| 14 | </tr> |
| 15 | <tr> |
| 16 | <td valign="top" align="left"><font face="Verdana" size="2"><b>Step 1.</b><br> |
| 17 | Install the Atom Pro module into the Bot Board II as shown in the diagram below.</font> |
| 18 | <p><font face="Verdana" size="2">Connect the serial data cable to the PC's serial port. This can be recognized by having 9 pins that stick out. |
| 19 | Connect the other end of the serial data cable to the Bot Board's DB9 port. See the troubleshooting guide for a list of tested USB-to-Serial |
| 20 | adaptors.</font></p> |
| 21 | <p><font face="Verdana" size="2">Please consult the <a href="https://community.robotshop.com/forum/t/serial-usb-to-serial-port-troubleshooting/17938" target="_blank">serial |
| 22 | troubleshooting guide</a> if you have difficulties with this.</font></p></td> |
| 23 | <td align="left" valign="top" width="320"> |
| 24 | <p align="center"><font face="Verdana" size="2"><img src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-atom-pro-programming/WebHome/comp.jpg" border="2" hspace="10" width="320" height="240"><br> |
| 25 | Figure 1.</font></p></td> |
| 26 | </tr> |
| 27 | <tr> |
| 28 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"> </font></td> |
| 29 | </tr> |
| 30 | <tr> |
| 31 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"><b>Step 1.</b><br> |
| 32 | Note: This schematic shows the default wiring and jumper configuration; even though servos are not used in this tutorial. Check to make sure |
| 33 | your Bot Board II is set up as shown in the diagram. Connect a 9vdc battery to the Bot Board's VL terminal. The green LED should light up |
| 34 | steadily.</font> |
| 35 | <p align="center"><font face="Verdana" size="2"><img src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-atom-pro-programming/WebHome/bb2tst01.gif" border="0" hspace="10" width="600" height="328"><br> |
| 36 | Figure 1.</font></p></td> |
| 37 | </tr> |
| 38 | <tr> |
| 39 | <td valign="top" align="left" colspan="2"><br class="pb"> |
| 40 | </td> |
| 41 | </tr> |
| 42 | <tr> |
| 43 | <td valign="top" align="left"><font face="Verdana" size="2"><b>Step 2.</b><br> |
| 44 | Download and install the latest version of the BASIC Atom Pro IDE.</font> |
| 45 | <p><font face="Verdana" size="2">Download the <a href="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-atom-pro-programming/WebHome/aprotut1.zip">sample BASIC Atom Pro program</a>, and save it on |
| 46 | your computer, somewhere you will be able to easily find it.</font></p> |
| 47 | <p><font face="Verdana" size="2">Open the IDE (double-click the desktop icon, or use the Start menu), then load up the sample program by |
| 48 | clicking on File -> Open.</font></p></td> |
| 49 | <td align="left" valign="top" > |
| 50 | <div align="center"> |
| 51 | <center> |
| 52 | <table border="1" width="324" bordercolor="#FFFFFF"> |
| 53 | <tbody><tr> |
| 54 | <td width="320" bordercolor="#808080" bgcolor="#C0C0C0"> |
| 55 | <p align="center"><font size="2" face="Verdana, Helvetica, sans-serif">Sample BASIC Atom Pro Program</font></p></td> |
| 56 | </tr> |
| 57 | <tr> |
| 58 | <td width="320" bordercolor="#C0C0C0" align="left" valign="middle"><font size="2" face="Courier New"><font color="#808080">;The compiler |
| 59 | will ignore any commands<br> |
| 60 | ;or text after a ; or '</font><br> |
| 61 | <br> |
| 62 | <font color="#0000FF">x var</font> <font color="#FF0000">word</font><br> |
| 63 | <br> |
| 64 | <font color="#0000FF">start</font><br> |
| 65 | <br> |
| 66 | <font color="#808080">;this will sound 3 ascending beeps</font><br> |
| 67 | <font color="#0000FF">sound</font> <font color="#FF0000">9</font>,[<font color="#FF0000">150</font>\<font color="#FF0000">2500</font>, <font color="#FF0000">150</font>\<font color="#FF0000">3000</font>, |
| 68 | <font color="#FF0000">150</font>\<font color="#FF0000">3500</font>]<br> |
| 69 | <font color="#808080">;pause for one second</font><br> |
| 70 | <font color="#0000FF">pause</font> <font color="#FF0000">1000</font><br> |
| 71 | <font color="#808080">;add one to the count</font><br> |
| 72 | <font color="#0000FF">x</font> = <font color="#0000FF">x</font> + <font color="#FF0000">1</font><br> |
| 73 | <font color="#808080">;sends the x back to the computer</font><br> |
| 74 | <font color="#0000FF">serout s_out</font>,<font color="#0000FF">i9600</font>,[DEC x, <font color="#FF0000">13</font>]<br> |
| 75 | <br> |
| 76 | <font color="#808080">;repeat</font><br> |
| 77 | <font color="#0000FF">goto</font> start</font></td> |
| 78 | </tr> |
| 79 | </tbody></table> |
| 80 | </center> |
| 81 | </div> |
| 82 | </td> |
| 83 | </tr> |
| 84 | <tr> |
| 85 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"> </font></td> |
| 86 | </tr> |
| 87 | <tr> |
| 88 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"><b>Step 3.</b><br> |
| 89 | Your screen should now look like Figure 2. Note that you can get more room for your programming window by turning off the "Workspace" |
| 90 | window: either click the X at its top right corner, or from the View menu choose Toolbars, then uncheck the "Workspace" toolbar.</font> |
| 91 | <p><font face="Verdana" size="2">The Build area (labeled "Output" at the bottom) shows error messages and compile time messages. You |
| 92 | can optionally hide the Build window by clicking the X at its top right corner, or from the View -> Toolbars menu ("Results" |
| 93 | toolbar). If you do hide it, make sure you unhide it again before compiling your program so you can see messages.</font></p> |
| 94 | <p><font face="Verdana" size="2">You can maximize the programming area (labeled with your file name; in this case "aprotut1") by |
| 95 | clicking the square Maximize button to the right of the file name.</font></p> |
| 96 | <p align="center"><font face="Verdana" size="2"><img src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-atom-pro-programming/WebHome/aprotut5.jpg" border="2" hspace="10" width="640" height="400"><br> |
| 97 | Figure 3.</font></p></td> |
| 98 | </tr> |
| 99 | <tr> |
| 100 | <td valign="top" align="left" colspan="2"><br class="pb"> |
| 101 | </td> |
| 102 | </tr> |
| 103 | <tr> |
| 104 | <td valign="top" align="left"><font face="Verdana" size="2"><b>Step 4.</b><br> |
| 105 | You will want to select your processor from the drop-down menu located next to the Debug button. </font> |
| 106 | <p><font face="Verdana" size="2">Now you need to change some options in order to connect with the Bot Board.</font></p> |
| 107 | <p><font face="Verdana" size="2">Click on Tools -> Preferences.</font></p></td> |
| 108 | <td align="left" valign="top" > |
| 109 | <p align="center"><font face="Verdana" size="2"><img src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-atom-pro-programming/WebHome/aprotut1.jpg" border="2" hspace="10" width="320" height="240"><br> |
| 110 | Figure 4.</font></p></td> |
| 111 | </tr> |
| 112 | <tr> |
| 113 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"> </font></td> |
| 114 | </tr> |
| 115 | <tr> |
| 116 | <td valign="top" align="left"><font face="Verdana" size="2"><b>Step 5.</b><br> |
| 117 | Click on "Find Atom Pro". This will locate the COM port that the Bot Board is connected to, and automatically set the appropriate COM |
| 118 | port to default.</font> |
| 119 | <p><font face="Verdana" size="2">Click "OK" to exit the Preferences screen.</font></p></td> |
| 120 | <td align="left" valign="top" > |
| 121 | <p align="center"><font face="Verdana" size="2"><img src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-atom-pro-programming/WebHome/aprotut2.jpg" border="2" hspace="10" width="320" height="235"><br> |
| 122 | Figure 5.</font></p></td> |
| 123 | </tr> |
| 124 | <tr> |
| 125 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"> </font></td> |
| 126 | </tr> |
| 127 | <tr> |
| 128 | <td valign="top" align="left"><font face="Verdana" size="2"><b>Step 6.</b><br> |
| 129 | If you have trouble with the IDE not connecting with the Atom Pro, you may need to make an adjustment in the Advanced Comm Settings screen. |
| 130 | Click on Tools -> Preferences -> Advanced.</font> |
| 131 | <p><font face="Verdana" size="2">Adjust the "Reset Hold Time" a little at a time, until the IDE is able to connect.</font></p> |
| 132 | <p><font face="Verdana" size="2">If you have no problems connecting, leave these settings alone.</font></p></td> |
| 133 | <td align="left" valign="top" > |
| 134 | <p align="center"><font face="Verdana" size="2"><img src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-atom-pro-programming/WebHome/aprotut6.jpg" border="2" hspace="10" width="219" height="338"><br> |
| 135 | Figure 6.</font></p></td> |
| 136 | </tr> |
| 137 | <tr> |
| 138 | <td valign="top" align="left" colspan="2"><br class="pb"> |
| 139 | </td> |
| 140 | </tr> |
| 141 | <tr> |
| 142 | <td valign="top" align="left"><font face="Verdana" size="2"><b>Step 7.</b><br> |
| 143 | Click on the "Program" button located in the toolbar as shown. This will compile the program and load it onto the Atom Pro.</font> |
| 144 | <p><font face="Verdana" size="2">The program will begin to run as soon as the Atom Pro receives it.</font></p></td> |
| 145 | <td align="left" valign="top" > |
| 146 | <p align="center"><font face="Verdana" size="2"><img src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-atom-pro-programming/WebHome/aprotut3.jpg" border="2" hspace="10" width="320" height="240"><br> |
| 147 | Figure 7.</font></p></td> |
| 148 | </tr> |
| 149 | <tr> |
| 150 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"> </font></td> |
| 151 | </tr> |
| 152 | <tr> |
| 153 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"><b>Step 8.</b><br> |
| 154 | Click on the "Terminal 1" tab at the bottom of the Output window, at the bottom of the screen. Make sure your settings are as shown in |
| 155 | the figure below.</font> |
| 156 | <p><font face="Verdana" size="2">Click the "Connect" button, and the results of the program (from the "serout" command) will |
| 157 | display as shown.</font></p> |
| 158 | <p align="center"><font face="Verdana" size="2"><img src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-atom-pro-programming/WebHome/aprotut4.jpg" border="2" hspace="10" width="627" height="198"><br> |
| 159 | Figure 8.</font></p></td> |
| 160 | </tr> |
| 161 | <tr> |
| 162 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"> </font></td> |
| 163 | </tr> |
| 164 | <tr> |
| 165 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"><b>Step 9.</b><br> |
| 166 | If you would like to fully test the Bot Board II and Atom Pro, download the <a href="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-atom-pro-programming/WebHome/bb2tst01.zip">Bot Board II testing |
| 167 | program</a>, and save it on your computer, somewhere you will be able to easily find it. Program the Atom Pro with this code.</font> |
| 168 | <p><font face="Verdana" size="2">When the program is running, you can test the ABC buttons and LEDs. Pressing the A button will add one to a |
| 169 | binary count that is visible on the LEDs. Pressing the B button will subtract one. The C button will clear the count.</font></p> |
| 170 | <p><font face="Verdana" size="2">The speaker circuitry is tested by emitting a tone when the buttons are pressed. All of the I/O pins are |
| 171 | toggled with each button press so you can read them with a volt meter.</font></p> |
| 172 | <p><font face="Verdana" size="2">By clicking on the Terminal 1 tab, you can read the analog input on Pin 16 (AX0), which will reflect the VS |
| 173 | value. You will need to change the Baud rate from 9600 to 57.6k in order to see these values.</font></p></td> |
| 174 | </tr> |
| 175 | </tbody></table> |
| 176 | </body> |
| 177 | {{/html}} |

