Wiki source code of BASIC Micro Studio Programming Tutorial for BASIC Atom Pro
Last modified by Eric Nantel on 2023/01/20 11:16
Hide last authors
![]() |
1.1 | 1 | {{html wiki="false" clean="true"}} |
![]() |
10.1 | 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 | ||
5 | Micro Studio Programming Tutorial for BASIC Atom Pro.</font></b> | ||
6 | <p><b><font face="Verdana" size="2">Updated <!--webbot bot="Timestamp" s-type="EDITED" s-format="%m/%d/%Y" startspan -->09/23/2009<!--webbot bot="Timestamp" i-CheckSum="12576" endspan -->.</font></b></p> | ||
![]() |
11.1 | 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> |
![]() |
10.1 | 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-micro-studio-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"> Note: This schematic shows the default wiring and jumper configuration; even though servos are not used in this tutorial. Check to make sure | ||
32 | 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 | ||
33 | steadily.</font> | ||
34 | <p align="center"><font face="Verdana" size="2"><img src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-micro-studio-programming/WebHome/bb2tst01.gif" border="0" hspace="10" width="600" height="328"><br> | ||
35 | Figure 1.</font></p></td> | ||
36 | </tr> | ||
37 | <tr> | ||
38 | <td valign="top" align="left" colspan="2"><br class="pb"> | ||
39 | </td> | ||
40 | </tr> | ||
41 | <tr> | ||
42 | <td valign="top" align="left"><font face="Verdana" size="2"><b>Step 2.</b><br> | ||
![]() |
13.1 | 43 | Download and install the latest version of the BASIC Micro Studio.</font> |
44 | <p><font face="Verdana" size="2">Download the <a href="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-micro-studio-programming/WebHome/aprotut1.zip">sample BASIC Atom Pro program</a>, and save it on | ||
![]() |
10.1 | 45 | your computer, somewhere you will be able to easily find it.</font></p> |
46 | <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 | ||
47 | clicking on File -> Open.</font></p></td> | ||
48 | <td align="left" valign="top" > | ||
49 | <div align="center"> | ||
50 | <center> | ||
51 | <table border="1" width="324" bordercolor="#FFFFFF"> | ||
52 | <tbody><tr> | ||
53 | <td width="320" bordercolor="#808080" bgcolor="#C0C0C0"> | ||
![]() |
11.1 | 54 | <p align="center"><font size="2" face="Verdana, Helvetica, sans-serif">Sample BASIC Atom Pro Program</font></p></td> |
![]() |
10.1 | 55 | </tr> |
56 | <tr> | ||
![]() |
11.1 | 57 | <td width="320" bordercolor="#C0C0C0" align="left" valign="middle"><font size="2" face="Courier New"><font color="#808080">;The compiler |
![]() |
10.1 | 58 | will ignore any commands<br> |
59 | ;or text after a ; or '</font><br> | ||
60 | <br> | ||
61 | <font color="#0000FF">x var</font> <font color="#FF0000">word</font><br> | ||
62 | <br> | ||
63 | <font color="#0000FF">start</font><br> | ||
64 | <br> | ||
65 | <font color="#808080">;this will sound 3 ascending beeps</font><br> | ||
66 | <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>, | ||
67 | <font color="#FF0000">150</font>\<font color="#FF0000">3500</font>]<br> | ||
68 | <font color="#808080">;pause for one second</font><br> | ||
69 | <font color="#0000FF">pause</font> <font color="#FF0000">1000</font><br> | ||
70 | <font color="#808080">;add one to the count</font><br> | ||
71 | <font color="#0000FF">x</font> = <font color="#0000FF">x</font> + <font color="#FF0000">1</font><br> | ||
72 | <font color="#808080">;sends the x back to the computer</font><br> | ||
73 | <font color="#0000FF">serout s_out</font>,<font color="#0000FF">i9600</font>,[DEC x, <font color="#FF0000">13</font>]<br> | ||
74 | <br> | ||
75 | <font color="#808080">;repeat</font><br> | ||
76 | <font color="#0000FF">goto</font> start</font></td> | ||
77 | </tr> | ||
78 | </tbody></table> | ||
79 | </center> | ||
80 | </div> | ||
81 | </td> | ||
82 | </tr> | ||
83 | <tr> | ||
84 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"> </font></td> | ||
85 | </tr> | ||
86 | <tr> | ||
87 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"><b>Step 3.</b><br> | ||
88 | Your screen should now look like Figure 2. Note that you can get more room for your programming window by turning off the "Workspace" | ||
89 | window: either click the X at its top right corner, or from the View menu choose Toolbars, then uncheck the "Workspace" toolbar.</font> | ||
90 | <p><font face="Verdana" size="2">The Build area (labeled "Build" at the bottom) shows error messages and compile time messages. You | ||
91 | can optionally hide the Build window by clicking the X at its top right corner, or from the View -> Toolbars menu ("Results" | ||
92 | toolbar). If you do hide it, make sure you unhide it again before compiling your program so you can see messages.</font></p> | ||
93 | <p align="center"><font face="Verdana" size="2"><img src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-micro-studio-programming/WebHome/aprotut3.jpg" border="2" hspace="10" width="681" height="400"><br> | ||
94 | Figure 3.</font></p></td> | ||
95 | </tr> | ||
96 | <tr> | ||
97 | <td valign="top" align="left" colspan="2"><br class="pb"> | ||
98 | </td> | ||
99 | </tr> | ||
100 | <tr> | ||
101 | <td valign="top" align="left"><font face="Verdana" size="2"><b>Step 4.</b><br> | ||
102 | Now you need to change some options in order to connect with the Bot Board. </font> | ||
103 | <p><font face="Verdana" size="2">Click on Tools -> Preferences.</font></p></td> | ||
104 | <td align="left" valign="top" > | ||
105 | <p align="center"><font face="Verdana" size="2"><img src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-micro-studio-programming/WebHome/aprotut4.jpg" border="2" hspace="10" width="320" height="240"><br> | ||
106 | Figure 4.</font></p></td> | ||
107 | </tr> | ||
108 | <tr> | ||
109 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"> </font></td> | ||
110 | </tr> | ||
111 | <tr> | ||
112 | <td valign="top" align="left"><font face="Verdana" size="2"><b>Step 5.</b><br> | ||
113 | Click on "Find Processor". This will locate the COM port that the Bot Board is connected to, and automatically set the appropriate COM | ||
114 | port and processor to default.</font> | ||
115 | <p><font face="Verdana" size="2">Click "OK" to exit the Preferences screen.</font></p></td> | ||
116 | <td align="left" valign="top" > | ||
117 | <p align="center"><font face="Verdana" size="2"><img src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-micro-studio-programming/WebHome/aprotut5.jpg" border="2" hspace="10" width="320" height="235"><br> | ||
118 | Figure 5.</font></p></td> | ||
119 | </tr> | ||
120 | <tr> | ||
121 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"> </font></td> | ||
122 | </tr> | ||
123 | <tr> | ||
124 | <td valign="top" align="left"><font face="Verdana" size="2"><b>Step 6.</b><br> | ||
125 | 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. | ||
126 | Click on Tools -> Preferences -> Advanced.</font> | ||
127 | <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> | ||
128 | <p><font face="Verdana" size="2">If you have no problems connecting, leave these settings alone.</font></p></td> | ||
129 | <td align="left" valign="top" > | ||
130 | <p align="center"><font face="Verdana" size="2"><img src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-micro-studio-programming/WebHome/aprotut6.jpg" border="2" hspace="10" width="219" height="338"><br> | ||
131 | Figure 6.</font></p></td> | ||
132 | </tr> | ||
133 | <tr> | ||
134 | <td valign="top" align="left" colspan="2"><br class="pb"> | ||
135 | </td> | ||
136 | </tr> | ||
137 | <tr> | ||
138 | <td valign="top" align="left"><font face="Verdana" size="2"><b>Step 7.</b><br> | ||
139 | Click on the "Program" button located in the toolbar as shown. This will compile the program and load it onto the Atom Pro.</font> | ||
140 | <p><font face="Verdana" size="2">The program will begin to run as soon as the Atom Pro receives it.</font></p></td> | ||
141 | <td align="left" valign="top" > | ||
142 | <p align="center"><font face="Verdana" size="2"><img src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-micro-studio-programming/WebHome/aprotut7.jpg" border="2" hspace="10" width="320" height="240"><br> | ||
143 | Figure 7.</font></p></td> | ||
144 | </tr> | ||
145 | <tr> | ||
146 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"> </font></td> | ||
147 | </tr> | ||
148 | <tr> | ||
149 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"><b>Step 8.</b><br> | ||
150 | 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 | ||
151 | the figure below.</font> | ||
152 | <p><font face="Verdana" size="2">Click the "Connect" button, and the results of the program (from the "serout" command) will | ||
153 | display as shown.</font></p> | ||
154 | <p align="center"><font face="Verdana" size="2"><img src="https://wiki.lynxmotion.com/info/wiki/lynxmotion/download/support/basic-micro-studio-programming/WebHome/aprotut8.jpg" border="2" hspace="10" width="606" height="199"><br> | ||
155 | Figure 8.</font></p></td> | ||
156 | </tr> | ||
157 | <tr> | ||
158 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"> </font></td> | ||
159 | </tr> | ||
160 | <tr> | ||
161 | <td valign="top" align="left" colspan="2"><font face="Verdana" size="2"><b>Step 9.</b><br> | ||
![]() |
15.1 | 162 | 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-micro-studio-programming/WebHome/bb2tst01.zip">Bot Board II testing |
![]() |
10.1 | 163 | 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> |
164 | <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 | ||
165 | binary count that is visible on the LEDs. Pressing the B button will subtract one. The C button will clear the count.</font></p> | ||
166 | <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 | ||
167 | toggled with each button press so you can read them with a volt meter.</font></p> | ||
168 | <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 | ||
169 | value. You will need to change the Baud rate from 9600 to 57.6k in order to see these values.</font></p></td> | ||
170 | </tr> | ||
171 | </tbody></table> | ||
172 | </body> | ||
![]() |
1.1 | 173 | {{/html}} |