Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Homepage
LPC8xx Internal Analog Comparator library¶
LPC800シリーズ(LPC812, LPC824等)に内蔵されているコンパレーター(比較器)を使うライブラリです。
使い方¶
初期化¶
ACMP acmp(vp, vn, hys, lad);
- vp = コンパレーター正入力(ACMP::LADDER / ACMP_I1~3 / BANDGAP)
- vn = コンパレーター負入力(ACMP::LADDER / ACMP_I1~3 / BANDGAP)
- hys = ヒステリシス選択(ACMP::NONE / HYS5mV / HYS10mV / HYS20mV)
- lad = 電圧ラダー選択(0~31)
コンパレーター入力に使えるピンは決まっています。(スイッチマトリクスで変更できません)
(LPC81x/82x) ACMP_I1=P0.0 / ACMP_I2=P0.1 / (LPC82x) ACMP_I3=P0.14 / ACMP_I4=P0.23
読み取り¶
acmp.read();
- 返り値
- 1: vp > vn
- 0: vp < vn
割込み¶
acmp.rise(*func);
- vp > vn を検出した時 func を呼び出す
acmp.fall(*func);
- vp < vn を検出した時 func を呼び出す
Sample¶
Import programACMP_sample
LPC8xx Internal Analog Comparator