The SPI and I 2C devices are both supported in hardware on the Atmega328 so you could conceivably be doing a transfer via SPI simultaneously with I 2C which would give you a speed boost.MCP23017 and MCP23S17) actually support both I 2C and SPI so you often can choose between speed, and the ability to have multiple devices on a single bus. The overhead of the I 2C is quite substantial, and if you are trying to interface really quickly, SPI is the preferred choice. Using I 2C you can only get around 40,000 bytes per second. The fastest rate quoted above is 888,888 bytes per second. I only read the shift register in the main file (function 'void btnscan (void)'). The two firsts pages are used to initialize the SPI bus. SPI is really the fastest method available on the Atmega328 (and similar) chips. Actually I need to do it through SPI (or I think so) because in the future I will have to control a lot of LEDs (more than 500) and I need a quite fast refresh.So, you might use it because the target device only supports it. For example the 74HC595 output shift register, the 74HC165 input shift register, the MAX7219 LED driver, and quite a few LED strips that I have seen. Some devices (quite a few) only support the SPI transfer method.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |