标题: BASCOM-AVR Read ADS1115 [打印本页] 作者: 箫天 时间: 2020-1-5 22:13 标题: BASCOM-AVR Read ADS1115 $regfile = "m8def.dat" ' specify the used micro $crystal = 8000000 ' used crystal frequency
'$baud = 19200 ' use baud rate $hwstack = 32 ' default use 32 for the hardware stack $swstack = 32 ' default use 10 for the SW stack $framesize = 64 ' default use 40 for the frame space
Osccal = &H9F
Dim Myinteger AsInteger Dim Voltage AsSingle Dim Vol_str AsString * 8
'(
Write to Config register:
First byte: 0b10010000 (first 7-bit I2C address followed by a low read/write bit) (H90/H91 OK)
Second byte: 0b00000001 (points to Config register)
Third byte: 0b10000100 (MSB of the Config register to be written)
Fourth byte: 0b10000011 (LSB of the Config register to be written)
Write to Pointer register:
First byte: 0b10010000 (first 7-bit I2C address followed by a low read/write bit) (H90/H91 OK)
Second byte: 0b00000000 (points to Conversion register)
Read Conversion register:
First byte: 0b10010001 (first 7-bit I2C address followed by a high read/write bit)
Second byte: the ADS1113/4/5 response with the MSB of the Conversion register
Third byte: the ADS1113/4/5 response with the LSB of the Conversion register
')