<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[forum.rcl-radio.ru &mdash; STM32 импульсный генератор 1кГц ... 64МГц]]></title>
	<link rel="self" href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=112&amp;type=atom" />
	<updated>2019-12-27T08:50:34Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.rcl-radio.ru/viewtopic.php?id=112</id>
		<entry>
			<title type="html"><![CDATA[STM32 импульсный генератор 1кГц ... 64МГц]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=617#p617" />
			<content type="html"><![CDATA[<p><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2019/12/4b10a391b8f520f5153ef0f81388b379.png" alt="http://forum.rcl-radio.ru/uploads/images/2019/12/4b10a391b8f520f5153ef0f81388b379.png" /></span> <br /><span class="attention-yellow"></span> </p><br /><br /><div class="codebox"><pre><code>#include &lt;Wire.h&gt; 
#include &lt;LiquidCrystal_I2C.h&gt; // liquidcrystali2c.zip
  LiquidCrystal_I2C lcd(0x27,16,2);  // Устанавливаем дисплей
  HardwareTimer pwmtimer3(3);

long int del=1,mn=1;
float f;

void setup() {
  lcd.init();                     
  lcd.backlight();// Включаем подсветку дисплея
  ///////////////////////////
  pinMode(PB0, PWM);
  pinMode(PB1,INPUT); // +
  pinMode(PB10,INPUT);// -
  pinMode(PB11,INPUT);// х1 х10 x100 x1000
  pwmtimer3.pause();
  pwmtimer3.setPrescaleFactor(del);       
  pwmtimer3.setOverflow(2-1);// /2         
  pwmtimer3.setCompare(TIMER_CH3, 1);// меандр
  pwmtimer3.refresh();
  pwmtimer3.resume();
}
void loop() {
    if(digitalRead(PB11)==HIGH){mn=mn*10;if(mn&gt;1000){mn=1;}}
    if(digitalRead(PB1)==HIGH){del=del+mn;if(del&gt;65535){del=65535;}pwmtimer3.setPrescaleFactor(del);}
    if(digitalRead(PB10)==HIGH){del=del-mn;if(del&lt;1){del=1;}pwmtimer3.setPrescaleFactor(del);}
    
  lcd.setCursor(0, 0);
  lcd.print(&quot;F = &quot;);
  f = 64000000/(1*del);
  if(f&gt;1000000){lcd.print(f/1000000,3);lcd.print(&quot; MHz   &quot;);}else{lcd.print(f/1000,3);lcd.print(&quot; kHz   &quot;);}
  lcd.setCursor(0,1);
  lcd.print(&quot;x&quot;);lcd.print(mn);lcd.print(&quot;   &quot;);lcd.setCursor(6,1);lcd.print(&quot;d&quot;);lcd.print(del);lcd.print(&quot;      &quot;);
  delay(300);
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2019-12-27T08:50:34Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=617#p617</id>
		</entry>
</feed>
