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

Committer:
IonSystems
Date:
Fri Dec 05 09:53:04 2014 +0000
Revision:
28:bdf2bf56f97b
Parent:
24:8868101d01d0
Commened main

Who changed what in which revision?

UserRevisionLine numberNew contents of line
IonSystems 6:e64796f1f384 1 #include "mbed.h"
IonSystems 24:8868101d01d0 2 //Define the integers to store the number of chips in each dispensor tube.
IonSystems 14:31ba3e56c788 3 int redAmount; //The amount of chips curs
IonSystems 6:e64796f1f384 4 int greenAmount;
IonSystems 6:e64796f1f384 5 int blueAmount;
IonSystems 23:f9e7e64784be 6 int recycleAmount;
IonSystems 6:e64796f1f384 7
IonSystems 24:8868101d01d0 8 /* readChipNumbers()
IonSystems 24:8868101d01d0 9 * Read the number of chips in each tube form the txt file on the MBED.
IonSystems 24:8868101d01d0 10 *
IonSystems 24:8868101d01d0 11 * The txt file provides non-volatile memory to store the keep track of
IonSystems 24:8868101d01d0 12 * the chips een if the device loses power.
IonSystems 24:8868101d01d0 13 */
IonSystems 6:e64796f1f384 14 void readChipNumbers(){
IonSystems 6:e64796f1f384 15 redAmount = readFile(0);
IonSystems 6:e64796f1f384 16 greenAmount = readFile(1);
IonSystems 6:e64796f1f384 17 blueAmount = readFile(2);
IonSystems 23:f9e7e64784be 18 recycleAmount = readFile(3);
IonSystems 6:e64796f1f384 19 }
IonSystems 24:8868101d01d0 20
IonSystems 24:8868101d01d0 21 //Decrement the amount of red chips in the storage tube by one.
IonSystems 24:8868101d01d0 22 void decrementRed(){
IonSystems 6:e64796f1f384 23 redAmount--;
IonSystems 6:e64796f1f384 24 }
IonSystems 24:8868101d01d0 25
IonSystems 24:8868101d01d0 26 //Decrement the amount of green chips in the storage tube by one.
IonSystems 6:e64796f1f384 27 void decrementGreen(){
IonSystems 6:e64796f1f384 28 greenAmount--;
IonSystems 6:e64796f1f384 29 }
IonSystems 24:8868101d01d0 30
IonSystems 24:8868101d01d0 31 //Decrement the amount of blue chips in the storage tube by one.
IonSystems 6:e64796f1f384 32 void decrementBlue(){
IonSystems 6:e64796f1f384 33 blueAmount--;
IonSystems 6:e64796f1f384 34 }
IonSystems 6:e64796f1f384 35
IonSystems 24:8868101d01d0 36 //Increment the amount of red chips in the storage tube by one.
IonSystems 6:e64796f1f384 37 void incrementRed(){
IonSystems 6:e64796f1f384 38 redAmount++;
IonSystems 6:e64796f1f384 39 }
IonSystems 24:8868101d01d0 40
IonSystems 24:8868101d01d0 41 //Increment the amount of green chips in the storage tube by one.
IonSystems 6:e64796f1f384 42 void incrementGreen(){
IonSystems 6:e64796f1f384 43 greenAmount++;
IonSystems 6:e64796f1f384 44 }
IonSystems 24:8868101d01d0 45
IonSystems 24:8868101d01d0 46 //Increment the amount of blue chips in the storage tube by one.
IonSystems 6:e64796f1f384 47 void incrementBlue(){
IonSystems 6:e64796f1f384 48 blueAmount++;
IonSystems 6:e64796f1f384 49 }