[dba-Tech] OT: PIC micro controllers

John W. Colby jwcolby at colbyconsulting.com
Wed Sep 7 23:09:15 CDT 2005


Most of these things have flash ram so you can write it over and over.
These are really cute little chips and pretty darned fast as well, anywhere
from 4 to 20 MHz.  They are a RISC processor with about 40 machine
instructions total, and various amounts of ram / flash ram, I/O pins, etc.
All depends on what you are willing to spend.  

I must admit that after the z-world Z-80 I was working on for the vending
machine project I am kind of spoiled, but then that was back in 97 so I have
a few years between me and that job.  That was a z-80 with something like
512 k of battery backed static ram which was used to download the program
into.  They have their own C compiler with a multi-tasking core etc.  About
20 I/O pins with high current drivers, built-in timers, watchdog timers,
counters, interrupt pins etc.  Of course each board was about $180 or so,
compared to a few dollars for the PIC series, depending of course on what
you want to get for your money.

That was in fact my sole real experience with long term programming in C.
Almost 2 years from start to finish.  I have to tell you that job was more
fun than anything I have ever done, before or since.  We were building a
little machine that hung on the wall and sold phone cards for the TelMex
phone system.  We designed a little card dispenser (hopper) with photo diode
sensors and switches to sense the position of a card being dispensed.
Because of my electronics background I designed all of the switch / led
sensor stuff as well as drivers for the card dispenser motor.  The machine
had a bill acceptor from an American company that the SBC talked to over
RS-488, basically sending simple byte strings of bill value.  All of the
electronics and the bill acceptor just connected right to the Z-80 SBC.

We then brought out an RS232 port through the wall of the box, which a
handheld computer connected to.  The hand held was used by the technician to
download sales data from the vending machine - number of cards sold and
price of each card, how much money should be in the bill acceptor, plus time
of day for each sale etc.  It then uploaded to the vending machine how many
cards were being installed, the price of the card (if the price was
changing) etc.  The handheld was then brought in to the office and the data
dumped into a database running on a PC to consolidate sales data from all
the machines.

We actually produced about 200 of these machines, and installed about 100,
including a slew of them in the Mexico city subway system, and a slew more
in tiendas and malls around Puebla.  I did all of the vending machine design
and programming, another programmer did the handheld - in Clipper, and
another programmer did the desktop database, in FoxPro.  FoxPro and Clipper
were (and probably still are) big in Mexico.  Programming the machine was a
blast because of the multi-tasking core which I used to cycle through tasks
looking at the bill acceptor, card dispenser, RS-232 port as well as
handling the recording of sales data when a card dispensed.  In a system
like that you "do it all", so I had to design structures for each sale, with
a double linked list to chain the sales structures in memory, then walk the
list dumping the data to the handheld etc.  

Tons of fun for a programmer.

John W. Colby
www.ColbyConsulting.com 

Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/

-----Original Message-----
From: dba-tech-bounces at databaseadvisors.com
[mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of MartyConnelly
Sent: Wednesday, September 07, 2005 11:06 PM
To: Discussion of Hardware and Software issues
Subject: Re: [dba-Tech] OT: PIC micro controllers


Wrote something like that back in late 80's, essentially a remote 
weather station for DOT
wind gauge, ceilorometer, dew cell thermometer etc. All running off 
 Intel 8036 4K
chips that communicated with an Intel 8081 for landline communications.

Got the gig by mistake, someone read my resume that had PL1 on it and
mistook it for PLM (an old Intel Macro assembler language). Luckily I had a
little backround in DOS, IBM and Honeywell assembler. I do remember having
to write lookup tables for sin cosine functions. You do need  good emulator
software before you go burning a lot of flash 
rom's.





More information about the dba-Tech mailing list