does anyone know of a device which can sit on the I2C Bus and can be addressed to give me a couple ( or more ) of Output ports?
i am building a water temperature, pump and Fan controller for my CNC Spindle motor and i have run ou of control ports to control it with my 18F SBC any ideas anyone?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just the Job .... Two Wire Clock and Data wit 8 ports I/O. Is the MCP23008 supported in GCB?
I have had a quick peek at the I2C PCF8574 Serial expander demo and the code is again way above my pay grade I think I'm going to need some help with the coding for this - in fact I KNOW I'm going to need some help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just realised. There is no demo for the MCP23008.
Here is the code.
// Include the library#include<MCP23008.h>// Define the address of the MCP, you can many devices#DEFINEMCP23008_DEVICE0X48/*There is two functionsmcp23008_sendbyte( in mcp23008_device, in mcp23008_instr , in mcp23008_data )mcp23008_readbyte( in mcp23008_device, in mcp23008_instr , Out mcp23008_data ) These are the constants defined.MCP23008_IODIR 0X00 ' DEFAULT IS INPUT 0= OUT 1= INMCP23008_IPOL 0X01 ' INPUT POLARITY 0= NORMAL, 1= INVERTEDMCP23008_GPINTEN 0X02 ' ALLOW INTERRUPT ON CHANGEMCP23008_DEFVAL 0X03 ' DEFAULT VALUE BEFORE INTERRUPT [FOR EASY COMPARE]MCP23008_INTCON 0X04 ' I/O EXPANDER CONFIGURATION .2 1= OPEN DRAIN [WIRE TOGETHER INTERRUPTS]MCP23008_IOCON 0X05MCP23008_GPPU 0X06 ' WEAK PULL UP RESISTORS [~100KOHHM] VERY HANDYMCP23008_ITF 0X07 ' WHO DONE IT, THE INTERRUPTMCP23008_INTCAP 0X08 ' SAVES THE EVENT THAT CAUSED THE INTERRUPTMCP23008_GPIO 0X09 ' THE IO PORTMCP23008_OLAT 0X0A ' THE LATCH OF THE IO PORT SEE DOC*/'setupMCP23008mcp23008_sendbyte(MCP23008_DEVICE,MCP23008_IODIR,0x00)'turnallpinsoutput'setportsstatusonMCP23008portsetvalue0=0mcp23008_sendbyte(MCP23008_DEVICE_1,MCP23008_GPIO,portsetvalue0)'turnallpinsoff'setportsstatusonMCP23008portsetvalue1=255mcp23008_sendbyte(MCP23008_DEVICE_1,MCP23008_GPIO,portsetvalue1)'turnallpinsontostate'readportsstatusonMCP23008ug_data=0// Set to zero to ensure you get a result. ug_data will be the 8bits of the MCP devices either 0 or 1 all 8 bits.mcp23008_readbyte(MCP23008_DEVICE_1,MCP23008_GPIO,ug_data)'readstate
Hope this helps. It is really easy to use... but, it is currently only software I2C. If this needs to change the hardware I2C then let us know.
Enjoy
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Searching. It's supported by gcb, i2c arduino nano so it's something you probably wrote.
All servos worked but the leg motion and a psu.. it got put on the shelf.
I found this.
does anyone know of a device which can sit on the I2C Bus and can be addressed to give me a couple ( or more ) of Output ports?
i am building a water temperature, pump and Fan controller for my CNC Spindle motor and i have run ou of control ports to control it with my 18F SBC any ideas anyone?
The PCF8574 is probably the most common with hobbyists but there are others just as capable. I think GCB has a library for the PCF8574.
Or the MCP23008 or MCP23017.
Just the Job .... Two Wire Clock and Data wit 8 ports I/O. Is the MCP23008 supported in GCB?
I have had a quick peek at the I2C PCF8574 Serial expander demo and the code is again way above my pay grade I think I'm going to need some help with the coding for this - in fact I KNOW I'm going to need some help.
MCP23008 ... it can be made to support you device.
I just realised. There is no demo for the MCP23008.
Here is the code.
Hope this helps. It is really easy to use... but, it is currently only software I2C. If this needs to change the hardware I2C then let us know.
Enjoy
I used 2 pca9685 boards to drive 18 rc servos using gcb.
Don't know if relevant.
Very relevent. :-)
Got any code to share?
Searching. It's supported by gcb, i2c arduino nano so it's something you probably wrote.
All servos worked but the leg motion and a psu.. it got put on the shelf.
I found this.
Last edit: stan cartwright 2023-01-12