Friday, March 1, 2013

The fifth lab day ( The test on the FPGA)

Today, we implement and test the design on the Altera DE1 board. The tests are successful.
Here is a example test.
First figure is the reset mode.

The reset mode
The second figure shows that the customer choose the product with the price of 70 penny. The SW3 is in logic 1.

Choose product of 70p

Then the customer press the pushbutton KEY3 to input 1 pound. The figure shows the result. The 7 segments display shows the change. The red LEDR3 is turned on to represent that the product has been dispensed successfully. And the green LEDG0 and LEDG3 represent one 10p and one 20p respectively.

After the input one pound

Wednesday, February 27, 2013

To assign the pin numbers

According to the reference manual for the cyclone II FPGA board, we now need to allocate the pin number to the inputs and outputs.

For the push button switches, we use them to represent the input coins.
Key3: 1 pound   key2: 50 penny   key1: 20 penny   key0: 10 penny

For the toggle switches, we use them to reset, cancel buy and choose product.
SW9: RESET  SW8: Cancel buy  SW7: product 150p  SW6: product 140p  SW5: product 120p
SW4: product 100p   SW3: product 70p  SW2: product 50p  SW1: product 40p SW0: product 30p

For the seven segment display, it is used to display the price of the chosen product for the customer. And it is also used to display the change that should be returned to the customer.

For the eight red LEDs (LEDR[7] to LEDR [0]), they are used to indicate that the product has been dispensed successfully.

For the eight green LEDs (LEDG[7] to LEDG[0]), they are used to indicate that the changes.

Monday, February 25, 2013

The whole connection of the internal circuit

After several days, we complete the codes for each components of the vending machine controller. Then, we try to combine each component into a single package.
The block diagram for the system is shown below.
The structure of the vending machine controller

Friday, February 22, 2013

The fourth lab day (Controller and Displayer)

Today is the fourth lab day. The task is to design the display component. Then we need to write the core of the system, which is the controller.

The fifth component is the displayer, which is used to display the price of the product and the change.
Here is the partial code for the displayer.


The partial code for displayer
 
 The controller is the cpu of the whole system, which send signals to display the information, dispense product or return the change.
Here is the partial code for the controller.

The partial code for controller

Wednesday, February 20, 2013

Product Selector and Product Dropper

The third component is the product selector, which is the part that allows the customer to choose the product.
Here is the partial VHDL code.


The partial code for the product selector
The  component is the product dropper, which is used to indicate that the product is dispensed.
Here is the partial VHDL code.
The partial code for the product dropper

Monday, February 18, 2013

Coin Receiver and Coin Changer

In this weekend, my partner and I decided to explore the different kinds of vending machine in the campus. And write the code for the

The first place is the central teaching building. The second place is the electronic and electrical building. After using these vending machines, we instantly found that we need to add the display part for the customor.

In this project, I really found that it is so interesting to apply what we know to the real life.

The first component is the coin receiver, which is the part that allows the customer to insert the coins.
Here is the partial VHDL code.


The partial code for the coin receiver
The second component is the coin changer, which is the part that cotrols the changes.
Here is the partial VHDL code.

The partial code for coin changer

Friday, February 15, 2013

The third lab day

Today, we offically begin to write the code for our vending machine.
1. The first decision we made is to write the code in VHDL. After doing the research, we found that VHDL is easier to write and more efficiency.

2. Then we try to design the top level structure of the vending machine. We think that there should be five components for the vending machine. Coin receiver, product selector, controller, product dropper and the coin changer. We decided to write separated codes for each part and then combine them into a single simple package.

3. In this project, we use the softeware Altera Quartus II and the DE1 development board.

Thursday, February 14, 2013

The basic flow chart for the operation of this machine

After having a short conversation with our supervisor, he suggested us to draw a flow chart for the machine. The graph can help us to write the code for the machine.

The flow chart is shown below.
The flow chart for the machine
 

Wednesday, February 13, 2013

Two resources which are inspiring

When we are doing the project, it is very necesary to study others works to improve our own works.

There are two materials that I found quite useful.

The first material helps me know better about the structure of the vending machine.

The Internet address is http://www.cse.sc.edu/~jimdavis/Courses/2003-Fall%20CSCE%20491/VendingMachine-031015.pdf.

The second material helps me know better about how to draw the state diagram.
The Internet address is https://coefs.uncc.edu/sjkuyath/files/2012/04/VendingMachine1.pdf.

Friday, February 8, 2013

The second lab day

Today, we have a longest discussion with our supervisor. We now have a more clear understand the structure of the vending machine. It consists two parts the controller and the architecture. The architecture is used to calculate the total money entered. And it should be able to control the 7 segment displays.

Tuesday, February 5, 2013

Input coins and Product price

Today, we draw the flow chart for the vending machine controller. It is the basic concept for this vending machine. If there is something wrong, we will improve it later. And we want to add the cancel function if the time allows.

The flow chart
 

Sunday, February 3, 2013

The knowledge about finite state machine

The vending machine controller can be seen as a finite state machine. We try to find some detailed explanation about the FSM on the Internet. I listed some key points I found useful.
 
1. Finite-state machine (FSM) is a mathematical model used to design both computer programs and sequential logic circuits.
 
2. A unique FSM is defined by a list of states and corresponding triggering conditions.
 
3. The machine can only be at one state at a time. The machine needs the triggering condition to move from current state to next state.
 
4. In our course ELEC211, we study two kinds of FSM including Mearly and Moore machine.
We separatly studied each kind of machine. For our project, I am wondering that it is possible to combine these two kinds of machines so that the ASM chart can be more precise.
 
5. Finite-state machines can be used to model many problems including electronic design automation (this is the area that our project links), communication protocol design, language parsing and so on.

Here is the website address. http://en.wikipedia.org/wiki/Finite-state_machine

Friday, February 1, 2013

The first lab day

Today, we had our first lab day. After the discussion with the supervisor, we now clearly know what the goal of the experiment and the steps to finish the project.

The basic aim of this project is to simulate the core of vending machine so that this FPGA device can do some functions as real machine.

Today, our job is to decide the design specifications for the machine. And then we attempt to draw the state diagram for the machine. In fact, the process to decide the number of state is very hard. For different products and coins, the combination is very complex. In the weekend, we still need some time to draw the diagram.

Thursday, January 31, 2013

The components of the vending machine

To design the vending machine controller. The very first thing is to study the vending machine in the real world. Because we want to know the basic structure and functions of the machine.
The general vending machine
Today, we thought about the general structure of the vending machine.
The general structure of the machine
Tomorrow, we will have our first lab day for the project. Hope everything goes well.



Wednesday, January 30, 2013

The mini project lauches

Hi, everyone:

This blog is for our year 2 project.

The project title is the development of a vending machine controller on an FPGA.

Before the Chritmas vacation, we had a small group meeting and a little discussion with our supervisor, Prof Jeremy.

In our first group meeting, my partner and I discussed our ideas about the project and then make a schedule for the project. And after discussion with the supervisor, he gave us a general guidance about how to start the project.