??? 01/26/05 22:30 Read: times |
#85875 - Both SPI and I2C Responding to: ???'s previous message |
If you've got the pins and code space, it's not difficult to bit-bang both SPI and I2C if you happen to be using a variant without dedicated SPI and/or I2C hardware.
If you look at vendor websites, you should be able to find apnotes describing interfacing a uC to a serial eeprom or such. Most times these are in assembly, and can be converted to C if needed. Performance on I2C pretty much requires asm. On your question about sine and non-sine waves, RMS will give you the most accurate readings. You can run your ADC off a timer interrupt, collect a cycle's worth of samples, then do the calculations required for RMS output. And you can do it without floating point. Fixed point works fine, and saves calculation time and code space. If your voltage/frequency range is known you can limit sizes of a square root lookup table if you don't want to implement an integer square root function. Dennis |