Hello all,
Ever wish you could incorporate some I2C based sensors with your VEX robots? Since VEX does not have a direct I2C connection ability, we have not been able to use sensors based on the I2C protocol.
What is posted here is a tested, working example of how to get data from an I2C-based device to a VEX controller via the VEX’s external serial port. It uses low-end PIC CPU as a translator which sits between the VEX and the I2C device.
The programs.zip file contains three programs. The first is a simple C program that runs on the VEX. It allows you to press any of three buttons, each of which sends a unique character to a PIC CPU. The second program, which runs on the PIC, then identifies the request and gets the associated data from the ‘sensor’ (EEPROM). For testing, an EEPROM chip was used instead of a sensor. The final program allows you to write data to the EEPROM from the PIC so that you will have known data on the EEPROM to test.
All power is drawn directly from the VEX controller.
The building blocks for the PIC code were obtained from Nigel Goodwin’s web site:
http://www.winpicprog.co.uk. I merely integrated Nigel’s code into a form more suited to this purpose.
Nigel Goodwin’s code base was selected because it is written to be very portable between different PIC CPUs. It has no specific hardware requirements such as MSSP. I chose the PIC16F690 since is it the CPU that comes with the PICKit 2 development environment. Most other 16F micro controllers should work too.
The other attachment is a schematic of the connections with all the details you need to recreate the environment. Please let me know if you have questions.
Regards,
KHall
programs.zip (7.93 KB)