Practical_Electronics-May_2019

([email protected]) #1

I/O pin 14, and if it is at a high logic level (which is represented
by the value 1), then the program fl ow will GOTO the label
waiting: – otherwise, it will continue on down to next line
of code. For our circuit, this means while the button is not
pressed the program fl ow will continually jump to waiting:
The only way the program will go past this IF...THEN...
line of code is when PIN(14)=0, ie, the button is pressed.
So go ahead and press F2 to run your new code. At fi rst,
nothing will appear to happen because the LED is not fl ashing.
However, the program fl ow is following your instructions
precisely and it is only when you press the button that the
LED will begin to fl ash.
We will now use a feature that demonstrates how you can
remove a hardware component simply by modifying the
SETPIN command. Refer to Fig.6 i), which is the circuit you
have currently working. Thanks to MMBASIC we can now
physically remove the pull-up resistor from our circuit and
use an additional parameter with the SETPIN command; as
follows: SETPIN(14),DIN,PULLUP
Run your code once again and check it all works (the LED
only starts fl ashing once you press the button).
Having worked through these simple digital input and
output building-block examples, you can begin to see just how
easy it is to use a Micromite to add intelligence to a project.
Furthermore, by just changing your code slightly (and leaving
the hardware the same), you can add features that are simply
not possible with hard wiring alone.


Next month
In the next part we will introduce a few more new commands
and techniques before building the Electronic Dice mini-project.
We will show you how easy it is to add an infrared remote
keypad to a Micromite, and will use this to make a simple dice
game. In the meantime, please enjoy experimenting!


Fig.7. A complete
kit of parts for the
Electronic Dice.
The kit includes a
mini-IR controller
and the relevant
IR receiver which
will be used in
many of our
mini-projects. It
is available from
micromite.org

JTAG Connector Plugs Directly into PCB!!
No Header! No Brainer!

Our patented range of Plug-of -Nails™ spring-pin cables plug directly
in to a tiny footprint of pads and locating holes in your PCB, eliminating
the need for a mating header. Save Cost & Space on Every PCB!!
Solutions for: PIC. dsPIC. ARM. MSP430. Atmel. Generic JTAG. Altera
Xilinx. BDM. C2000. SPY-BI-WIRE. SPI / IIC. Altium Mini-HDMI. & More

http://www.PlugOfNails.com
Tag-Connector footprints as small as 0.02 sq. inch (0.13 sq cm)

Visit: http://www.eeweb.com


and go to the EPE Magazine


sub-topic in the forums,


or just browse around!


Chat Zone has a new home!


Your magazine


area on EEWeb

Free download pdf