This project was
inspired when I was
playing BINGO with my
friends. Somehow during
play, the numbers that
were called got mixed up,
and there was confusion
as to whether or not one
of the players had
actually won the game.
PLAYING WITH PICS
It seemed to me
that having a
and verify the
numbers would be
much more reliable.
The game of BINGO is quite
simple: any number from 1 to 75
is picked and called out to the players.
Numbers may not be called more than
once during any game. Once a player
has selected all the numbers in a row
(vertical, horizontal, or diagonal), he
yells out “BINGO” and wins the game.
A program for BINGO must be
able to randomly pick any number
from 1 to 75, and display it as it
should be called, i.e., “B17” or
“N39.” The program must keep track
of which numbers have been used
and prevent them from being
displayed again in the same game.
The displayed numbers must then be
available for verification once a player has called BINGO. (See the sidebar for more details about the game).
V+ Vee Gnd
+5V 1 mclr B7 28
2 A0 B627
3 A1 B5 26
4 A2 B4 25
5 A3 B3 24
6 A4 B223
7A5 16F870 B122
9 osc1 V+ 20
22 Osc pF TP 10 osc2 19
11 C0 C718
12 C1 C617
13 C2 C516
14 C3 C415
R/W RS E
Osc TP = Approx . 7 Mhz
I have used the PIC16F870 in previous projects and find it extremely
versatile and well behaved. A different
PIC could have been used in the project (for example, a 16F84A), but since
I had several 16F870s on hand from
previous projects, I decided to use it.
The program presented here can
easily be modified to use almost any
PIC that has at least 11 general-purpose I/O lines to control the LCD
and accommodate the push button
switches. This project uses a standard
four data bit LCD display with
the Hitachi HD44780 controller.
However, any other LCD using the
HD44780 controller could also be
used. Add a few push-button switches,
some resistors, a few capacitors, and
presto! You have BINGO on a PIC.
The schematic is shown in Figure 1.
Verify 01 YES
■ FIGURE 1
The heart of this project is in the
programming. To me, PIC programming is a very interesting subject, and
there are many PC-based software
programs to choose from. Many
purists will tell you the best way to
write programs for PICs (but not
the easiest) is using the 35 assembly