tel:704-822-9380
fax:704-822-9390 |
||
|
MicroGUI in Education
Overview: When MicroGUI software is running on a PC, it provides a set of Graphical Input and Output Controls for interfacing with any Stamp or Micro. Only a serial link is needed between the PC and the target device. In the case of a Stamp or a Self-Loading AVR, then the existing programming cable can serve both purposes - no new hardware is needed. MicroGUI is all about interaction, and when combined with the appeal of analog controls it makes the whole human interface real-world, and more natural. To be totally correct, the analog controls are 'Virtual' since they are implemented graphically on a screen - but when compared to 'Real' ones, they do not need wiring, debugging, and are essentially 'for free'. Typical uses for these controls could be grouped into three categories:
There are no restrictions on the combination of different types of controls, but those three areas were the influence for what has been incorporated so far. Also note that the user determines the actual mix of Real and Virtual devices. For instance, one example below has a 'Real' potentiometer controlling the speed of a 'Virtual' stepper motor on the PC screen. The Scope: This is an important extension to MicroGUI, and especially for learning. It offers up to 4 channels where each can represent 1 Analog, or 4 Digital signals for maximums of 4 and 16 signals respectively. Any combination of analog and digital is permissible. To assist in the interpretation of port pin digital data, the user can change the default allocation of 'Pins to Channel numbers' or reverse the order of significance. Normally digital data is plotted 'by event' which means that the traces only step across the screen when one or more signals change. This allows excellent interaction between the User and the Micro for a deeper understanding. Sensor inputs or internal variables can both be plotted as analog data. Seeing variables as analog data is very revealing in comparison to scrolling Debug values. For example, a counter becomes a ramp generator, if it misses a beat or gets reset, it is abundantly clear. Combining both also has value. When conducting experiments with analog sensors for instance, adding digital signals can readily identify events and conditions for a complete picture. Speed could become a factor in capturing sensor data, in that all values need to be sent serially to the PC which takes time. However, in the case of a Self-Loading AVR with its relatively enormous 1024 bytes of RAM, all data can be captured at microsecond speeds, then dumped to the PC at a slower rate when complete. Benefits in Education:
Ready-to-run Projects for Education: The ready-to-run Projects below are just a few of the current 20 or so that come with the Download. Once downloaded, nothing more is needed than 'Run' microgui.exe for it to automatically self-extract and install. That also includes the creation of separate directories for the PC Projects, and matching BS2 and Bascom programs. To run each of the examples (some are shown below) requires for instance \Projects\Starter1.prj to get the PC end setup. Followed by a 'matching' \BS2_Code\Starter1.bs2 'Program' to load a Parallax Stamp - or \BC_Code\Starter1.bas to load a Self-Loading AVR. Immediately, you are running the example project - in the exact same way each student hits the ground running at the start of every class. To get first hand experience: Download Demo v1.0 of MicroGUI For educators who would prefer a CD, please supply a School/College address for delivery to: support@rhombus-tek.com
|
||
|
Basic Controls |
||
|
|
||
| 4/16 Analog/Digital Scope | ||
|
|
||
| Components added for Learning purposes | ||
|
|
||
|
Ready to Run Projects LEDs 1 |
||
|
|
Loop:
GoSub RdPins
IF IN.Bit1 = 1 THEN Yellow
Green:
OUT.Bit15 = IN.Bit0 GoTo UpDate
Yellow:
OUT.Bit14 = IN.Bit0
UpDate:
GoSub WrPins
GoTo Loop
|
|
| LEDs 2 | ||
|
|
Loop:
GoSub RdPins
Tmp = INLo ^ OldINLo & 3 'Only look for changes OldINLo = INLo 'Save rgdls 'cos of next decision IF Tmp & INLo = 0 THEN Loop 'Only want +ve changes
IF Tmp.Bit0 = 0 THEN DoCount
OUTHi.Nib1 = OUTHi.Nib1 << 1 GoTo UpDate DoCount: OUTHi.Nib1 = OUTHi.Nib1 + 1
UpDate:
GoSub WrPins
GoTo Loop
|
|
| Driving a 7 Segment Digit | |
|
|
|
| Multiplexing a 4 Digit display | |
| Hardware Shift-In Register | |
| Hardware Shift-Out Register | |
| Manual Shift-In & Shift-Out | |
| Auto Shift-In & Shift-Out | |
| Manual Shift Register Display | |
| Auto Shift Register Display | |
| LCD Display with Keypad | |
|
|
|
| Manual Operation of a Stepper Motor | |
| Auto Operation of a Stepper Motor | |
|
|
|
|
The speed of the 'accurately animated' Stepper motor can be changed with the on screen slider, or by using a potentiometer in the local bread board - code below. It demonstrates that the user is not committed to all devices being virtual. The reverse of the above would have the PC's slider controlling a real stepper and that would also be fine. Both real and virtual I/O can be used together in a project. The pot costs less than $1, the stepper plus drivers much more - and you cannot look inside a real motor as it is running. The manual version (prior project above) allows full experimenting and animates all fault conditions without burning out the drivers and windings.
'------------ Local Speed Control
SkipSldr: High 8 Pause 1 RCtime 8, 1, StepTime StepTime = StepTime/2 Max 500
NextStep:
IF StepTime > 250 THEN Fwds
Bkwds:
IF StepTime > 240 then Loop 'User must see the change of direction
StepNbr = (StepNbr + Mask) & Mask 'Add a
FullCycle-1, then Mask out the O/Flows
READ (Table + StepNbr), OUTHi.HighNib GOSUB WrPins PAUSE StepTime GOTO Loop
Fwds:
StepTime = 500 - StepTime 'Reverse scale direction to make symmetrical IF StepTime > 240 then Loop ' and user must see that changeover
StepNbr = (StepNbr + 1) & Mask 'Same Add then
Mask, but only 1 O/Flow per Cycle
READ (Table + StepNbr), OUTHi.HighNib GOSUB WrPins PAUSE StepTime GOTO Loop |