Anyone have experience with Microchip MCP2200

Discussion in 'Embedded Systems and Microcontrollers' started by Fordy, Mar 2, 2013.

  1. Fordy

    Thread Starter New Member

    Nov 29, 2011
    Hi there, I'm sorry not to be asking a specific question, but I have quite a few!

    I'm using the MCP2200 USB interface (PIC18F14K50 with firmware) as part of an A level project. Getting a bit panicky because the rest of my project is pretty reliant on this part working!

    I've read through Microchip's documentation, but I've struggled to find anyone with much experience to help.

    I'm working out a hardware kink at the moment (says USB device not recognised), but beyond that my current issues are:

    1- I'm not experienced in C/C++, so I've written the program to interface with it in Python, which I am familiar with - however I'm not clear how to get Python talking to the MCP2200.

    I tried to use the examples in the datasheet with something called BOOST.Python, in order to send the values grabbed from the chip over to the Python program - but I really don't know what I'm doing with it, and I certainly haven't used it before.

    2- I then found the "DLLs" in documentation and software downloads. So I became even more confused. It actually mentioned Python at some point, but didn't seem to provide example code.

    Ultimately - is there some way I can send commands to the MCP2200 directly from Python?

    Functions I need are the configuration ones, read the 8-bit value on GPIO, and read the device number.

    Here's the C I wrote:
    Code ( (Unknown Language)):
    2. #include <boost/python.hpp>
    4.     using namespace boost::python;
    5.     def("initusb", initusb);
    6.     def("grabuid", grabuid);
    7.     def("grabzid", grabzid);
    8. };
    10. //functions
    11. bool    initusb(){
    12.     InitMCP2200 (0x4D8, 0x00F);
    13.     if (SimpleIOclass::ConfigureMCP2200(0xFF, 9600, OFF, OFF, false, false, false) != SUCCESS) {return false};
    14.     else{return true};
    15. }
    17. int     grabuid(){
    18.     int uid;
    19.     uid = SimpleIOClass::ReadPortValue();
    20.     if (uid == 0x8000){
    21.         uid = 0x00;
    22.     };
    23.     return uid;                                         //gives python the 8bit value on GPIO port (users ID)
    24. };
    26. int     grabzid(){
    27.     int zid;
    28.     return SimpleIOClass::GetSelectedDevice();          //gives python the device ID, for use when multiple devices present (multiple zones)
    29. };

    Will be very grateful to anyone who can help out!