モデル | UARTチャネル数 | プログラマブルI/Oピン | SPI Clock Speed |
---|---|---|---|
SC16IS740 | Single | 無し(※) | 4 Mbit/s |
SC16IS741 | Single | 無し(※) | 4 Mbit/s |
SC16IS750 | Single | 有り | 4 Mbit/s |
SC16IS752 | Dual | 有り | 4 Mbit/s |
SC16IS760 | Single | 有り | 15 Mbit/s |
SC16IS762 | Dual | 有り | 15 Mbit/s |
SC16IS750 | ATmega328 | 備考 |
---|---|---|
i2c-SPI | 5V | i2c/SPIの切り替え |
A0-CS | 5V | i2cアドレスの選択(※) |
A1-SI | 5V | i2cアドレスの選択(※) |
NC-SO | N/C | i2cの時は使わない |
SCL-SCK | SCL | PullUpする必要が有る |
SDA-VSS | SDA | PullUpする必要が有る |
/IRQ | N/C | どこにも繋がっていない |
RESET | N/C | 基板上でPullUpされている |
VIN | 5V | |
GND | GND |
#include <Wire.h> #include <SC16IS750.h> #include <string.h> #include <SPI.h> SC16IS750 i2cuart = SC16IS750(SC16IS750_PROTOCOL_I2C,SC16IS750_ADDRESS_AA); //Connect TX and RX with a wire and run this sketch //#define baudrate 57600 //#define baudrate 115200 #define baudrate 230400 //#define baudrate 460800 //#define baudrate 921600 void setup() { Serial.begin(115200); Serial.println("start i2cuart"); // UART to Serial Bridge Initialization i2cuart.begin(baudrate); //baudrate setting if (i2cuart.ping()!=1) { Serial.println("device not found"); while(1); } else { Serial.println("device found"); } Serial.print("start serial communication. baudrate = "); Serial.println(baudrate); } void loop() { static char buffer[64] = {0}; static int index = 0; if (i2cuart.available() > 0){ // read the incoming byte: char c = i2cuart.read(); #if 0 Serial.print("c="); if (c < 0x20) { Serial.print(" "); } else { Serial.print(c); } Serial.print(" 0x"); Serial.println(c,HEX); #endif if (c == 0x0d) { } else if (c == 0x0a) { Serial.print("["); Serial.print(buffer); Serial.println("]"); index = 0; } else { buffer[index++] = c; buffer[index] = 0; } } } |
#include <stdio.h> void main() { long crystal_freq = 3072000; // 3,072,000MHz long prescaler = 1; long baudrate = 3600; long divisor1 = crystal_freq/prescaler; long divisor2 = baudrate*16; double divisorf = (double)divisor1/(double)divisor2; long divisor = divisorf + 0.999; printf("divisor1=%ld divisor2=%ld divisor=%ld divisorf=%f\n", divisor1, divisor2, divisor, divisorf); long actual_baudrate = (divisor1/divisor)/16; printf("actual_baudrate=%ld\n", actual_baudrate); } |