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:
Mon Nov 10 16:32:44 2014 +0000
Revision:
8:b7771391adc9
Parent:
7:6ba00694f9cd
Child:
12:814a8fdbb6f7
added red dispense test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
IonSystems 7:6ba00694f9cd 1 enum StateMachine{
IonSystems 7:6ba00694f9cd 2
IonSystems 7:6ba00694f9cd 3 //Initializing state
IonSystems 7:6ba00694f9cd 4 INITIALISING,
IonSystems 7:6ba00694f9cd 5
IonSystems 8:b7771391adc9 6 //Stored value states
IonSystems 8:b7771391adc9 7 READING_RGB_VALUES, //read stored values from MBED datafile
IonSystems 8:b7771391adc9 8 WRITING_RGB_VALUES, //write stored values to MBED datafile
IonSystems 8:b7771391adc9 9 INCREMENT_RED,
IonSystems 8:b7771391adc9 10 INCREMENT_GREEN,
IonSystems 8:b7771391adc9 11 INCREMENT_BLUE,
IonSystems 8:b7771391adc9 12 DECREMENT_RED,
IonSystems 8:b7771391adc9 13 DECREMENT_GREEN,
IonSystems 8:b7771391adc9 14 DECREMENT_BLUE,
IonSystems 8:b7771391adc9 15
IonSystems 7:6ba00694f9cd 16
IonSystems 7:6ba00694f9cd 17 //Dispensing states
IonSystems 7:6ba00694f9cd 18 DISPENSE_RED,
IonSystems 7:6ba00694f9cd 19 DISPENSE_GREEN,
IonSystems 7:6ba00694f9cd 20 DISPENSE_BLUE,
IonSystems 7:6ba00694f9cd 21
IonSystems 7:6ba00694f9cd 22 //Sorting states
IonSystems 7:6ba00694f9cd 23 SORT_RED,
IonSystems 7:6ba00694f9cd 24 SORT_GREEN,
IonSystems 7:6ba00694f9cd 25 SORT_BLUE,
IonSystems 7:6ba00694f9cd 26 SORT_BIN,
IonSystems 7:6ba00694f9cd 27 SORT_RECYCLE,
IonSystems 7:6ba00694f9cd 28
IonSystems 7:6ba00694f9cd 29 //Card reader states
IonSystems 7:6ba00694f9cd 30 READ_CARD,
IonSystems 7:6ba00694f9cd 31 WAITING_FOR_CARD,
IonSystems 7:6ba00694f9cd 32 WAITING_FOR_DATABASE,
IonSystems 7:6ba00694f9cd 33 RECIEVING_AMOUNTS, //The MBED is recieving the number of each colour of token to dispense.
IonSystems 7:6ba00694f9cd 34
IonSystems 7:6ba00694f9cd 35 //MBED LCD states
IonSystems 7:6ba00694f9cd 36 DISPLAY_WELCOME, //Display a welcome message.
IonSystems 7:6ba00694f9cd 37 DISPLAY_AMOUNTS, //Display the amount of tokens requested.
IonSystems 7:6ba00694f9cd 38 DISPLAY_LEVELS, //Display the current sorted chip levels.
IonSystems 7:6ba00694f9cd 39 DISPLAY_LANGUAGE, //Display the current language.
IonSystems 7:6ba00694f9cd 40 DISPLAY_COMPLETED, //Display an 'order completed' message.
IonSystems 7:6ba00694f9cd 41 DISPLAY_SORTING, //Display a 'currently sorting' message.
IonSystems 7:6ba00694f9cd 42 DISPLAY_DISPENSING, //Display a 'dispensing' message.
IonSystems 7:6ba00694f9cd 43
IonSystems 8:b7771391adc9 44 //PC States
IonSystems 8:b7771391adc9 45 WAITING_FOR_ACK,
IonSystems 8:b7771391adc9 46 WAITING_FOR_CHAR,
IonSystems 7:6ba00694f9cd 47 //External LCD States
IonSystems 7:6ba00694f9cd 48
IonSystems 8:b7771391adc9 49 //Maintenance mode states
IonSystems 8:b7771391adc9 50 RB_LEFT,
IonSystems 8:b7771391adc9 51 RB_CENTRE,
IonSystems 8:b7771391adc9 52 RB_RIGHT,
IonSystems 8:b7771391adc9 53 GO_UP,
IonSystems 8:b7771391adc9 54 GO_CENTRE,
IonSystems 8:b7771391adc9 55 GO_DOWN,
IonSystems 8:b7771391adc9 56 BR_LEFT,
IonSystems 8:b7771391adc9 57 BR_RIGHT,
IonSystems 8:b7771391adc9 58 R_PUSH,
IonSystems 8:b7771391adc9 59 R_HOME,
IonSystems 8:b7771391adc9 60 GB_LEFT,
IonSystems 8:b7771391adc9 61 GB_CENTRE,
IonSystems 8:b7771391adc9 62 GB_RIGHT
IonSystems 6:e64796f1f384 63 };