<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[forum.rcl-radio.ru &mdash; Миллиомметр на ADS1110]]></title>
	<link rel="self" href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=409&amp;type=atom" />
	<updated>2021-07-26T08:15:06Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.rcl-radio.ru/viewtopic.php?id=409</id>
		<entry>
			<title type="html"><![CDATA[Миллиомметр на ADS1110]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=4517#p4517" />
			<content type="html"><![CDATA[<p><a href="http://rcl-radio.ru/?p=100859">http://rcl-radio.ru/?p=100859</a></p><div class="codebox"><pre><code>#include &lt;Wire.h&gt;
#include &lt;STM32_TM1637.h&gt;                // http://rcl-radio.ru/wp-content/uploads/2020/02/STM32_TM1637_V1_3.zip
STM32_TM1637 tm(2,3);// CLK, DIO

#define ADDR 0x48
#define U33 3.342
int n=3;
float r,u,n_u=0.256,r0;
  long dig_sum,dig;
  int value,f;
  
void setup() {
  Serial.begin(9600);
  tm.brig(7); // ЯРКОСТЬ 0...7
  Wire.begin();
  pinMode(4,INPUT_PULLUP);// null
}

void loop() {
  r = ((100.00*u)/(U33-u))-r0;
  if(digitalRead(4)==LOW&amp;&amp;r&lt;0.1){r0=((100.00*u)/(U33-u));delay(200);}

  for(int i=0;i&lt;10;i++){
  read_u();
  dig_sum = dig_sum+value;delay(10);}

read_u();if(value&gt;0x7FFF-0xF&amp;&amp;n==1){delay(10);n=0;n_u=2.048;}
read_u();if(value&gt;0x7FFF-0xF&amp;&amp;n==2){delay(10);n=1;n_u=1.024;}
read_u();if(value&gt;0x7FFF-0xF&amp;&amp;n==3){delay(10);n=2;n_u=0.512;}
read_u();if(value&lt;16380&amp;&amp;n==0){delay(10);n=1;n_u=1.024;}
read_u();if(value&lt;16380&amp;&amp;n==1){delay(10);n=2;n_u=0.512;}
read_u();if(value&lt;16380&amp;&amp;n==2){delay(10);n=3;n_u=0.256;}
 
  dig = dig_sum/10;dig_sum=0;
  u = dig*n_u/0x7FFF;

 if(r&lt;10){tm.print_float(r,3 ,0,0,0,0);}
 if(r&gt;=10&amp;&amp;r&lt;100){tm.print_float(r,2 ,0,0,0,0);}
 if(r&gt;=100&amp;&amp;r&lt;=150){tm.print_float(r,1 ,0,0,0,0);}
 if(r&gt;150){tm.print_float(r,0 ,0b01000000,0b01000000,0b01000000,0b01000000);}
 
 Serial.println(r0,5);
  }

float read_u(){
  Wire.beginTransmission(ADDR);
  Wire.write (0b10001100+n);
  Wire.endTransmission();
  Wire.requestFrom(ADDR,2);
  while(Wire.available()&lt;2);
  value = (Wire.read()&lt;&lt;8) + (Wire.read());
  }  </code></pre></div>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2021-07-26T08:15:06Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=4517#p4517</id>
		</entry>
</feed>
