I did a search but didn't come back with much. . .is it possible to send >8bits using any of the aforementioned protocols?
one crude way of sending 9 databits using UART is to use the paritybit as data.
with spi and i2c you can send a multible of 8 bits.
Maybee a software spi is the easiest solution?
Yes... I deal with 12 bit LT A/Ds and D/As all the time... the spi is just a shift register, so if you want to send 12 bits over to a dac for example, and the dac wants the bits most significant bit first (spi can do that!), just put the bytes in memory 'left justified'... the first byte has the most significant 8 bits, the next bit has the last 4 and 4 bits of garbage... hopefully the dac will latch the data after the 12th bit and everything is fine. I have seen the opposite setup, where the extra bits are FIRST, and get shifted out the other end, leaving the 12 bits you want in the dac. Have to study how the external chip really works!
Imagecraft compiler user
so both spi and i2c can send 8bits+n*8bits as a stream? What I want to do is send the 10bit adc value from the mega16 to an aduc7020 12bit dac without truncating 2 bits within the adc value
You got me there. SPI I know about. I2C is a mysterious black box to me. I recompiled Jorg's I2C eeprom read and write and got it to work, but man thats a lot of code to read and write a byte to a rom!
Easiest way is to transfer your 10-bit value as two 8-bit values. How and with what bus? That is up to you. aduc7020 is an ARM processor so I guess you have to do both ends anyway.
Edit: you can send two 8-bit bytes on any of the above bus, usart, spi or i2c.
You can read/write multiple bytes in I2C. You need to send 1 byte + 1 acknowledge bit = 9 bits so SPI is better suited for what you want.
To use I2C you also need a device with I2C interface.
I'm not sure about the older "mature" AVRs, but I think all the current AVRs all have up to 9 bit data USARTs. The AT90PWM chips have an EUSART with up to 16/17 bit data modes.
Both devices have all the above three interfaces. Required 9th bit for acknowledging is transparent to the user if hardware TWI controller is used, so only real difference between I2C and SPI is that to send data you need to use some kind of Chip Select signal with SPI while with TWI you need to send start conditions and stop conditions and I2C device addresses.
© 2021 Microchip Technology Inc.