![]() 1909 Old Mountain Creek Road, Greenville, SC 29609 tel:864.233.8330 fax:864.233.8331 |
|
|
|
|
The traced execution below is based on the template 'Tmpl_Rob.BS2' and has a cycle of 5 Ticks, of which 2 are used to feed data back to the PC as shown below.
Trace details top downwards: Busy: A spare pin driven high whenever the BS2 was working.
PC Transmit (28,800 Baud) supplying 3 real-time User bytes from 2 sliders and a set of 8 Debug switches in the demo - time for more. Eight times per second. BS2 Transmit (28,800 Baud) a total of 20+ bytes for the Application & Debug screens of the microGUI interface, plus a handshake with the PC. Eight times per second. Two Wheel Encoders with 36 segments for 60 counts/sec total in above diagram – capable of 80/sec if precise mark/space. Trade possible for double speed. Combining with microGUI for a Visual Demo:Hardware:Even without a BOE-BOT, establishing a 28,800 baud, bi-directional link between a PC and the BS2 will be worthwhile for other applications.
Software: BS2 Code: With the hardware still fresh in mind, take a copy of Demo_Rob.BS2 from the CD's \Green directory and re-allocate the DPin, CPin and Tick as needed. Already the code for 5 sensors (2 wheel, 2 Sharp, 1 DevanTech) has been commented out. This leaves the pin allocation for the 4 connections made above, plus the 2 servos, to be adjusted. At
the same time look for the following code under 'INITIALIZATION': PC Code: There is a Demo version of microGUI provided as a simple means of interfacing with the PC. It is self-extracting and can be found here: \ Demos \ microGUI \ microGUI.exe. Once installed, replace the startup project with \ Projects \ Demo_Rob.Prj to achieve the screen below. The Comm settings need 28,800 Baud, Full Duplex and Header Length options.
Because SMt can squeeze in PC communication without compromising its own control tasks, the internal operation can be revealed in real-time. That means better insight and therefore solutions. With wheels raised off the bench, hit 'On-Line'. The Amber LED's should start flashing. If not, and even after double checking all of the above, then pull the PC transmit and receive wires from the breadboard, connect together and try again. This will determine whether it is a PC or BS2 problem. Once running, the servo controls and feedback will be active - all other BS2 code is still commented out. Now is the time to bring that code back in with your own pin allocation. Or to write your own code to drop into those time slots. The BS2 code listing reveals which bytes are being exchanged with the PC. That includes the 6 switches on the right so that they can be used as remote controls of the BS2's internal operation. Real-Time Analog View: Aside from code, seeing the sensor outputs in analog form can really help finding the optimum angle/position. Move objects, change light levels, simulate low/loaded system voltage, and see the results on the screen, real-time. Beats any LCD, and costs less. |
| SMt Initialization Bytes: | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||