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

FPGAcomms.h

Committer:
IonSystems
Date:
2014-11-10
Revision:
8:b7771391adc9
Parent:
6:e64796f1f384
Child:
9:8d78eb55ad5e

File content as of revision 8:b7771391adc9:

#include "mbed.h"

//Setup pins to FPGA
DigitalOut startSort(p5);       //A positive edge tells the FPGA to start sorting.

/*
  The command codes for the three sort select bits(ColourBit1 - ColourBit2)
    000     Sort red chip
    001     Sort green chip
    010     Sort blue chip
    011     Bin the chip
    100     Recycle the chip
    101     Nothing
    110     Nothing
    111     Nothing
*/

DigitalOut colourBit1(p6);      //The 3 bits below are select bits for the sorter.
DigitalOut colourBit2(p7);
DigitalOut colourBit3(p8);
DigitalOut startDispense(p9);   //A positive edge tells the FPGA to start dispensing.
/*
    00      Dispense red chip
    01      Dispense green chip
    10      Dispense blue chip
    11      Nothing
*/

DigitalOut dispenseBit1(p10);  //The 2 bits below are select bits for the dispenser.
DigitalOut dispenseBit2(p11);

DigitalIn complete(p12);    //FPGA sets to 1 once complete until another signal is recieved.
DigitalOut select(p15); //0 for control, 1 for maintenance.