liuzhiyong
Newbie
Required Hardware
This is tested on Arduino Uno R3, but it should work on other Arduino types, if the API is compatible. (Only Arduino functions are used, no fancy stuff of registers. It should be compatible)
Required Software
Get the source code with GitHub link at:
https://signaloperator.com/
Example #1 - Drive "at24c01" with I2C
i2cscan (Scan for I2C slave devices, 50 is AT24C01)
i2cwrite @50 00 nostop (Address 00)
i2cread @50 04 stop (Read 04 bytes)
i2cwrite @50 00 F0 F1 F2 F3 stop (Write F0 F1 F2 F3 to address 00)
i2cwrite @50 01 AA BB stop (Write AA BB to address 01)
i2cwrite @50 00 nostop (Address 00)
i2cread @50 04 stop (Read 04 bytes)
We read four bytes in the end, which shows two operations of writing are both done. Here is the screenshot:
Example #2 - Drive "lm75a" with I2C
i2cscan (Scan for I2C slave devices, 48 is LM75A)
i2cwrite @48 00 nostop (Address 00, Temperature)
i2cread @48 02 stop (Two bytes of data)
We read data in the end, and it's "(0x1360>>7)*0.5 = 19°C". Here is the screenshot:
Example #3 - Drive "w25q128" with SPI
spi @0AM0 03 00 00 00 FF FF FF FF (Read 4 bytes from address 00 00 00)
spi @0AM0 06 (Enable writing)
spi @0AM0 02 00 00 00 11 22 33 44 (Write 4 bytes to address 00 00 00)
spi @0AM0 03 00 00 00 FF FF FF FF (Read 4 bytes from address 00 00 00)
We read four bytes in the end, which shows the writing operation is done. Here is the screenshot:
More Details
The text editor in these screenshots contains detailed explanation(for example, how to use another SPI mode). And the source code, one nice "ino" file, contains tons of comment explaining everything in great detail.
This is tested on Arduino Uno R3, but it should work on other Arduino types, if the API is compatible. (Only Arduino functions are used, no fancy stuff of registers. It should be compatible)
Required Software
Get the source code with GitHub link at:
https://signaloperator.com/
Example #1 - Drive "at24c01" with I2C
i2cscan (Scan for I2C slave devices, 50 is AT24C01)
i2cwrite @50 00 nostop (Address 00)
i2cread @50 04 stop (Read 04 bytes)
i2cwrite @50 00 F0 F1 F2 F3 stop (Write F0 F1 F2 F3 to address 00)
i2cwrite @50 01 AA BB stop (Write AA BB to address 01)
i2cwrite @50 00 nostop (Address 00)
i2cread @50 04 stop (Read 04 bytes)
We read four bytes in the end, which shows two operations of writing are both done. Here is the screenshot:
Example #2 - Drive "lm75a" with I2C
i2cscan (Scan for I2C slave devices, 48 is LM75A)
i2cwrite @48 00 nostop (Address 00, Temperature)
i2cread @48 02 stop (Two bytes of data)
We read data in the end, and it's "(0x1360>>7)*0.5 = 19°C". Here is the screenshot:
Example #3 - Drive "w25q128" with SPI
spi @0AM0 03 00 00 00 FF FF FF FF (Read 4 bytes from address 00 00 00)
spi @0AM0 06 (Enable writing)
spi @0AM0 02 00 00 00 11 22 33 44 (Write 4 bytes to address 00 00 00)
spi @0AM0 03 00 00 00 FF FF FF FF (Read 4 bytes from address 00 00 00)
We read four bytes in the end, which shows the writing operation is done. Here is the screenshot:
More Details
The text editor in these screenshots contains detailed explanation(for example, how to use another SPI mode). And the source code, one nice "ino" file, contains tons of comment explaining everything in great detail.