intuf.blogg.se

Arduino nano in multisim
Arduino nano in multisim





arduino nano in multisim

Next, you want to set the first pin HIGH, you send 0x01 (or 0b0000001) to GPIO. You could send it as Binary if you wanted to-0b00000000. For example, say you wanted to set all pins as outputs, you would send a value of 0x00 to the IODIR register. The Value is what is passed into the Register. You first have to set the direction with IODIR, then you can set the pins HIGH or LOW using GPIO. GPIO (0x09) sets the OUTPUT value of the GPIO pins. You can have any combination of INPUTS and OUTPUTS you want. IODIR (0x00) tells the chip what direction the GPIO pins will have. There are 11 Registers in total, and when you get more advanced with this chip, using them should be easy. Each register is a byte of data that tells the chip how to operate. This is because the least significant bit in this byte is a R/W bit.Īll information in the MCP23S08 is stored in Registers. 4 LOW and 5 HIGH would give 0x43, for example. If you're using multiple chips, you could change the settings on 4 & 5 to give you a different address. The datasheet shows how this works out, but with both 4 & 5 LOW, the address is 0x40. In my diagram I have pulled them both LOW. Pins 4 & 5 on the MCP23S08 are the address lines.

arduino nano in multisim

When you want to interact with the chip, you have to pull the chip select LOW, specify an Address, a Register and a Value, and then pull the chip select back to HIGH each time.







Arduino nano in multisim