IDES Pop Machine Version 1
Details on IDES software
asm.zip - Master Unit
c.zip - Slave Unit
IDES.jar - Software that communicates with Pop Machine
pop.gml - Model of Pop Machine for import to IDES
See Also: IDES Pop Machine Version 2
This is my first implementation of a hardware pop machine model. I've used two pic16f84 microcontrollers. The chip beside the LCD functions as a slave unit and only controls the LCD. It receives two byte packages from the master unit via serial communication and updates the LCD accordingly. The master chip handles the "Insert Token" button, the "Request Pop" button and the "Pop Delivery" LED. It also sends notification of events to the PC via an rs232 connection at the bottom left of the circuit, and commands the slave chip to update the LCD via rs232 over the two green wires at the centre of the circuit. The two unlabeled buttons are reset buttons for the respective chips. The red toggle switches allow isolation for programming in place. The two bundles of wires exiting the circuit at the left are for programming in place. The green wire mess on the slave circuit where the red toggle switches would be is simply a hardwired version of the toggle switches in the "normal" configuration. Note that the master chip can command the slave chip to display the startup logo on the LCD, but the resetting prompt only appears on the LCD when the slave chip has been physically reset via its button. Also note that the capacitors for the master chip's clock circuit are missing only because I ran out. Technically, the circuit shouldn't work without them.
The system is specified as follows: When the "Insert Token" button is pressed then released, then if the current number of tokens in the system is less than 15 then the number of tokens is incremented and the LCD displays the "Total Tokens" prompt with the current number of tokens. If there are already 15 tokens in the system then the number of tokens is not incremented and the "Total Tokens" prompt with the current number of tokens is displayed on the LCD along with the "Token Rejected!" prompt. When the "Request Pop" button is pressed then released, then if there are at least three tokens in the system, the current number of tokens is reduced by three, and the "Now attempting to deliver pop." prompt is displayed on the LCD. At this time the "Pop Delivery" LED flashes a few times, then the "Total Tokens" prompt with the current number of tokens is displayed on the LCD. While the "Pop Delivery" LED is flashing, all user input is ignored. If there are less than three tokens in the system when a pop is requested, the input is simply ignored.
This model can be summarized as a pop machine that accepts one type of token and sells one type of pop at a cost of three tokens. The pop machine has an infinite supply of pop and infinite space for input tokens; however it caps the current credits at a maximum of 15 tokens. When the system is reset, all history is forgotten.
The slave unit code is written in C and compiled using PICC LITE. It is available for download as c.zip and contains the following files:
- main.c : The main program. It includes the pinout for the 16f84 and comments on the serial connection.
- lcd.c : The LCD routines. It includes the pinout for the LCD and all lcd related code. This code depends on delay.c
- rs232.c : The rs232 routines. These are used only for serial communications with the master pic. This code depends on delay.c
- delay.c : Simple delay routines.
- delay.h : The header file for delay.c
- MAIN.HEX : The compiled code.
The master unit code is written in assembly and compiled using MPASMWin. It is available for download as asm.zip and contains the following files: Note that discussion of serial cable connections (for the PC connection) are included in the rs232.c file from the c.zip package, and that documentation is not include here, although it certainly applies.
- main.asm : The main program. The pinout is not included, but should be obvious from circuit photo. All pin references are done using EQU, so the "equates" section at the top of the code should suffice as a pinout specification.
- p16f84.inc : The generic include file that specifies equates for basic register names, etc.
- main.LST : The listing file generated at compile time.
- main.HEX : The compiled code.
A simple fsm was created to demonstrate the interface between the IDES hardware and software. It is available as pop.gml
And just in case the software is greatly modified in the future the jar used at the time of this writing is available as IDES.jar (I believe IE auto-renames jar to zip, so you'll have to rename it)