The MBED firmware used on the Chipin sorter, developed over 12 weeks for a 3rd year university systems project. Chipin is a token sorter, it sorts tokens by colours and dispenses them to order through an online booking system and card reader. This program interfaces with an FPGA, PC and LCD screen to control the sorter. The sorter has an operation mode where it can process orders when a card is entered into the machine. There is also a maintenance mode where the device responds to maintenance instructions such as 'dispense all'. More information at http://www.ionsystems.uk/

Dependencies:   MCP23017 TCS3472_I2C WattBob_TextLCD mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers chipNumbers.h Source File

chipNumbers.h

00001 #include "mbed.h"
00002 //Define the integers to store the number of chips in each dispensor tube.
00003 int redAmount;          //The amount of chips curs
00004 int greenAmount;
00005 int blueAmount;
00006 int recycleAmount;
00007 
00008 /*  readChipNumbers()
00009  *  Read the number of chips in each tube form the txt file on the MBED.
00010  *  
00011  *  The txt file provides non-volatile memory to store the keep track of
00012  *  the chips een if the device loses power.
00013 */
00014 void readChipNumbers(){
00015     redAmount = readFile(0);
00016     greenAmount = readFile(1);
00017     blueAmount = readFile(2);
00018     recycleAmount = readFile(3);
00019     }
00020 
00021 //Decrement the amount of red chips in the storage tube by one.
00022 void decrementRed(){    
00023     redAmount--;
00024     }
00025     
00026 //Decrement the amount of green chips in the storage tube by one.
00027 void decrementGreen(){
00028     greenAmount--;
00029     }
00030     
00031 //Decrement the amount of blue chips in the storage tube by one.
00032 void decrementBlue(){
00033     blueAmount--;
00034     }
00035     
00036 //Increment the amount of red chips in the storage tube by one.
00037 void incrementRed(){
00038     redAmount++;
00039     }
00040     
00041 //Increment the amount of green chips in the storage tube by one.
00042 void incrementGreen(){
00043     greenAmount++;
00044     }
00045     
00046 //Increment the amount of blue chips in the storage tube by one.
00047 void incrementBlue(){
00048     blueAmount++;
00049     }