Anyone have experience with Microchip MCP2200

Thread Starter

Fordy

Joined Nov 29, 2011
15
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:
Rich (BB code):
#include <boost/python.hpp>
BOOST_PYTHON_MODULE(MCP2200){
    using namespace boost::python;
	def("initusb", initusb);
    def("grabuid", grabuid);
	def("grabzid", grabzid);
};

//functions
bool	initusb(){
	InitMCP2200 (0x4D8, 0x00F);
	if (SimpleIOclass::ConfigureMCP2200(0xFF, 9600, OFF, OFF, false, false, false) != SUCCESS) {return false};
	else{return true};
}

int 	grabuid(){
	int uid;
	uid = SimpleIOClass::ReadPortValue();
	if (uid == 0x8000){
		uid = 0x00;
	};
	return uid;											//gives python the 8bit value on GPIO port (users ID)
};

int 	grabzid(){
	int zid;
	return SimpleIOClass::GetSelectedDevice();			//gives python the device ID, for use when multiple devices present (multiple zones)
};

Will be very grateful to anyone who can help out!

Cheers,
 
Top