![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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
cardReader.h@13:0661d658d9d1, 2014-11-20 (annotated)
- Committer:
- IonSystems
- Date:
- Thu Nov 20 11:15:47 2014 +0000
- Revision:
- 13:0661d658d9d1
- Parent:
- 12:814a8fdbb6f7
- Child:
- 23:f9e7e64784be
Maintenance mode added, still need to do the printouts to the lcd.
Who changed what in which revision?
User | Revision | Line number | New 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 | 12:814a8fdbb6f7 | 12 | int cardValues[6] = {0,0,0,0,0,0}; |
IonSystems | 6:e64796f1f384 | 13 | |
IonSystems | 10:8c0696b99692 | 14 | bool cardDataAcquired = false; |
IonSystems | 10:8c0696b99692 | 15 | |
IonSystems | 6:e64796f1f384 | 16 | void cardAcquisition(){ |
IonSystems | 6:e64796f1f384 | 17 | lcd->reset(); |
IonSystems | 6:e64796f1f384 | 18 | lcd->locate(0,0); //Going to new line |
IonSystems | 6:e64796f1f384 | 19 | if(cardBit1) lcd->printf("p1=1,"); |
IonSystems | 6:e64796f1f384 | 20 | else lcd->printf("p1=0,"); |
IonSystems | 12:814a8fdbb6f7 | 21 | cardValues[0] = cardBit1; |
IonSystems | 6:e64796f1f384 | 22 | |
IonSystems | 6:e64796f1f384 | 23 | if(cardBit2) lcd->printf("p2=1,"); |
IonSystems | 6:e64796f1f384 | 24 | else lcd->printf("p2=0,"); |
IonSystems | 12:814a8fdbb6f7 | 25 | cardValues[1] = cardBit2; |
IonSystems | 6:e64796f1f384 | 26 | |
IonSystems | 6:e64796f1f384 | 27 | if(cardBit3) lcd->printf("p3=1"); |
IonSystems | 6:e64796f1f384 | 28 | else lcd->printf("p3=0"); |
IonSystems | 12:814a8fdbb6f7 | 29 | cardValues[2] = cardBit3; |
IonSystems | 6:e64796f1f384 | 30 | |
IonSystems | 6:e64796f1f384 | 31 | lcd->locate(1,0); //Going to new line |
IonSystems | 6:e64796f1f384 | 32 | |
IonSystems | 6:e64796f1f384 | 33 | if(cardBit4) lcd->printf("p4=1"); |
IonSystems | 6:e64796f1f384 | 34 | else lcd->printf("p4=0,"); |
IonSystems | 12:814a8fdbb6f7 | 35 | cardValues[3] = cardBit4; |
IonSystems | 6:e64796f1f384 | 36 | |
IonSystems | 6:e64796f1f384 | 37 | |
IonSystems | 6:e64796f1f384 | 38 | if(cardBit5) lcd->printf("p5=1,"); |
IonSystems | 6:e64796f1f384 | 39 | else lcd->printf("p5=0,"); |
IonSystems | 12:814a8fdbb6f7 | 40 | cardValues[4] = cardBit5; |
IonSystems | 6:e64796f1f384 | 41 | |
IonSystems | 6:e64796f1f384 | 42 | if(cardBit6) lcd->printf("p6=1"); |
IonSystems | 6:e64796f1f384 | 43 | else lcd->printf("p6=0"); |
IonSystems | 12:814a8fdbb6f7 | 44 | cardValues[5] = cardBit6; |
IonSystems | 6:e64796f1f384 | 45 | |
IonSystems | 13:0661d658d9d1 | 46 | //cardDataAcquired = true; |
IonSystems | 6:e64796f1f384 | 47 | |
IonSystems | 6:e64796f1f384 | 48 | } |