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:
Wed Nov 12 20:14:45 2014 +0000
Revision:
10:8c0696b99692
Parent:
6:e64796f1f384
Child:
12:814a8fdbb6f7
works with serial and buttons, ready for demo tomorrow 13-11-14

Who changed what in which revision?

UserRevisionLine numberNew contents of line
IonSystems 6:e64796f1f384 1 #include "mbed.h"
IonSystems 6:e64796f1f384 2
IonSystems 6:e64796f1f384 3 DigitalIn cardBit1(p21);
IonSystems 6:e64796f1f384 4 DigitalIn cardBit2(p22);
IonSystems 6:e64796f1f384 5 DigitalIn cardBit3(p23);
IonSystems 6:e64796f1f384 6 DigitalIn cardBit4(p24);
IonSystems 6:e64796f1f384 7 DigitalIn cardBit5(p25);
IonSystems 6:e64796f1f384 8 DigitalIn cardBit6(p26);
IonSystems 6:e64796f1f384 9 DigitalIn cardDetect(p29);
IonSystems 6:e64796f1f384 10
IonSystems 6:e64796f1f384 11
IonSystems 6:e64796f1f384 12 int cardValue1 = 0;
IonSystems 6:e64796f1f384 13 int cardValue2 = 0;
IonSystems 6:e64796f1f384 14 int cardValue3 = 0;
IonSystems 6:e64796f1f384 15 int cardValue4 = 0;
IonSystems 6:e64796f1f384 16 int cardValue5 = 0;
IonSystems 6:e64796f1f384 17 int cardValue6 = 0;
IonSystems 6:e64796f1f384 18
IonSystems 10:8c0696b99692 19 bool cardDataAcquired = false;
IonSystems 10:8c0696b99692 20
IonSystems 6:e64796f1f384 21 void cardAcquisition(){
IonSystems 6:e64796f1f384 22 lcd->reset();
IonSystems 6:e64796f1f384 23 lcd->locate(0,0); //Going to new line
IonSystems 6:e64796f1f384 24 if(cardBit1) lcd->printf("p1=1,");
IonSystems 6:e64796f1f384 25 else lcd->printf("p1=0,");
IonSystems 6:e64796f1f384 26 cardValue1 = cardBit1;
IonSystems 6:e64796f1f384 27
IonSystems 6:e64796f1f384 28 if(cardBit2) lcd->printf("p2=1,");
IonSystems 6:e64796f1f384 29 else lcd->printf("p2=0,");
IonSystems 6:e64796f1f384 30 cardValue2 = cardBit2;
IonSystems 6:e64796f1f384 31
IonSystems 6:e64796f1f384 32 if(cardBit3) lcd->printf("p3=1");
IonSystems 6:e64796f1f384 33 else lcd->printf("p3=0");
IonSystems 6:e64796f1f384 34 cardValue3 = cardBit3;
IonSystems 6:e64796f1f384 35
IonSystems 6:e64796f1f384 36 lcd->locate(1,0); //Going to new line
IonSystems 6:e64796f1f384 37
IonSystems 6:e64796f1f384 38 if(cardBit4) lcd->printf("p4=1");
IonSystems 6:e64796f1f384 39 else lcd->printf("p4=0,");
IonSystems 6:e64796f1f384 40 cardValue4 = cardBit4;
IonSystems 6:e64796f1f384 41
IonSystems 6:e64796f1f384 42
IonSystems 6:e64796f1f384 43 if(cardBit5) lcd->printf("p5=1,");
IonSystems 6:e64796f1f384 44 else lcd->printf("p5=0,");
IonSystems 6:e64796f1f384 45 cardValue5 = cardBit5;
IonSystems 6:e64796f1f384 46
IonSystems 6:e64796f1f384 47 if(cardBit6) lcd->printf("p6=1");
IonSystems 6:e64796f1f384 48 else lcd->printf("p6=0");
IonSystems 6:e64796f1f384 49 cardValue6 = cardBit6;
IonSystems 6:e64796f1f384 50
IonSystems 6:e64796f1f384 51 cardDataAcquired = true;
IonSystems 6:e64796f1f384 52
IonSystems 6:e64796f1f384 53 }