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 cardReader.h Source File

cardReader.h

00001 #include "mbed.h"
00002 //  Define the card reader input pins.
00003 DigitalIn cardBit1(p21);
00004 DigitalIn cardBit2(p22);
00005 DigitalIn cardBit3(p23);
00006 DigitalIn cardBit4(p24);
00007 DigitalIn cardBit5(p25);
00008 DigitalIn cardBit6(p26);
00009 DigitalIn cardDetect(p29);
00010 
00011 /*  cardAcquisition()
00012  *  Reads the binary values of the card reader inputs and converts them into a decimal number.
00013  *  The decimal number is returned as an integer.
00014  */
00015  
00016 int cardAcquisition(){
00017         //Work out the number of the card
00018         int cardNumber = 0;
00019         //Bit 1
00020         if(cardBit1) cardNumber += 1;
00021         if(cardBit2) cardNumber += 2;
00022         if(cardBit3) cardNumber += 4;
00023         if(cardBit4) cardNumber += 8;
00024         if(cardBit5) cardNumber += 16;
00025         if(cardBit6) cardNumber += 32;
00026         
00027         return cardNumber;  
00028     }