A simple oscilloscope using Adafruit 2.8" TFT with touch. Runs on FRDM-KL25Z, FRDM-K22F, FRDM-K64F, NUCLEO-F411RE. 2 channel analog inputs with 4 trigger modes and time division.
Dependencies: SPI_STMPE610 UniGraphic mbed vt100
My first attempt of implementing an oscilloscope using FRDM-KL25Z and Adafruit 2.8" TFT with touch.
FRDM-KL25Z と Adafruit 2.8" TFT with touch を使用して作ってみた最初のオシロスコープです。
On 25-Sep-2017, wrong calculation of trigger pos/val fixed.
On 25-Nov-2015, FRDM-K64F and NUCLEO-F411RE platforms were added.
On 26-Nov-2015, FRDM-K22F is added (tested).
Note: Now ch2 is A2 instead of A1!
25-Sep-2017, トリガー値と位置の計算の誤りを修正しました。
25-Nov-2015, FRDM-K64F と NUCLEO-F411RE でも動くようになりました。
26-Nov-2015, FRDM-K22F でも動作確認が出来ました。
※一身上の都合で、アナログ入力の ch2 は A1 から A2 に変更しましたので、ご注意ください。m(_ _)m
This supports two analog inputs A0 for channel 1 and A2 for channel 2
and four trigger modes (NONE, RISE, FALL, LEVEL),
time division is 30us to 20ms per pixel which will make 300us/div to 200.0ms/div (as 10 pixels per div)
A0と A2 のアナログ2入力にて、
4種類のトリガーモード(NONE: フリーラン RISE: 立ち上がりエッジ、FALL: 立下りエッジ、LEVEL: レベル) 。
サンプリングは30us から 20ms, チャートの1メモリが10ピクセルなので、300us/dev から 200.0ms/div となっています。
The analog signals and gnd was picked at the pins in the picture above.
Note: now you need to pick A0 and A2 instead of A0 and A1.
信号は上記の写真のように、Adafruit のピンからつまみました。
変更により、A0とA2が入力となります。
When powered on or reset, the program starts in Trigger Mode = NONE (Free Run Mode)
電源投入、リセット後 プログラムはトリガーモード NONE (フリーランモード) で起動します。
To change trigger mode and/or time division, press run/stop button.
トリガーモードを変えたり、サンプリング時間を変えるのには run/stop ボタンを押してください。
Each time you push Trig button, the trigger mode changes
NONE -> RISE -> FALL -> LEVEL ( -> NONE).
トリガーボタンを押すたびにトリガーモードは
NONE(フリーラン) -> RISE (立ち上がりエッジ) -> FALL (立下りエッジ) -> LEVEL (レベル)
と変化します。
When trigger mode is not NONE,
to specify the trigger position, level and channel, push inside the wave frame.
Then green trigger marks will be shown and value of trigger position and voltage will be printed.
トリガーモードが NONE でないときに、チャネルの枠内をタッチしますと、
その位置がトリガーのポジション、レベル、チャネルになります。
そして、緑色のトリガーマークが表示され、下部にはトリガーの具体的なポジションとボルテージが表示されます。
To change time division push
"1/2" to Zoom Out (sampling interval will be bigger) or
"x2" to Zoom In (Sampling interval will be smaller).
サンプリングタイムを変更するのには
"1/2" ズームアウト (サンプリング間隔が長くなります) か
"x2" ズームイン (サンプリング間隔が短くなります。) を押してください。
On 7-Mar-2015 updated to UniGraphic library version!
2015年3月7日 UniGraphic ライブラリ使用版にアップデートしました。
FRDM-KL25Z
FRDM-K64F
NUCLEO-F411RE
Diff: main.h
- Revision:
- 8:62982cc8e5d8
- Parent:
- 6:c93e2f12b789
- Child:
- 9:657155f03cb8
--- a/main.h Wed Nov 25 13:07:28 2015 +0000 +++ b/main.h Tue Apr 11 08:35:50 2017 +0000 @@ -85,6 +85,68 @@ #define PIN_ADC_CH0 PA_0 #define PIN_ADC_CH1 PA_4 +#elif defined (TARGET_K20D50M) +#define PIN_SCLK PTD1 +#define PIN_MISO PTD3 +#define PIN_MOSI PTD2 +#define PIN_CS_TFT PTC2 +#define PIN_DC_TFT PTA2 +#define PIN_CS_TSC PTA12 +#define PIN_BL_TFT PTC4 +#define PIN_CS_SD PTC8 +#define PIN_TSC_INTR PTA4 /* place holder */ +#define PIN_RESET_TFT PTC7 /* place holder */ +#define PIN_ADC_CH0 PTC0 +#define PIN_ADC_CH1 PTD6 + +#elif defined (TARGET_RZ_A1H) +#define PIN_SCLK P10_12 +#define PIN_MISO P10_15 +#define PIN_MOSI P10_14 +#define PIN_CS_TFT P10_13 +#define PIN_DC_TFT P8_14 +#define PIN_CS_TSC P8_15 +#define PIN_BL_TFT P8_11 +#define PIN_CS_SD P4_5 +#define PIN_TSC_INTR P2_9 /* place holder */ +#define PIN_RESET_TFT P2_10 /* place holder */ +#define PIN_ADC_CH0 P1_8 +#define PIN_ADC_CH1 P1_10 +#elif defined (TARGET_MAX32600MBED) +/* I2C */ +#define PIN_SCL P2_7 +#define PIN_SDA P2_6 +/* SPI */ +#define PIN_SCLK P2_0 +#define PIN_MISO P2_2 +#define PIN_MOSI P2_1 +#define PIN_CS0 P2_3 +/* Interrupt */ +#define PIN_INT0 P2_4 +#define PIN_INT1 P2_5 +#define PIN_INT2 P1_7 +#define PIN_INT3 P1_6 +#define PIN_INT4 P1_5 +#define PIN_INT5 P1_4 +/* Analog In */ +#define PIN_AN0 AIN_0P +#define PIN_AN1 AIN_1P +#define PIN_AN2 AIN_2P +#define PIN_AN3 AIN_3P +#define PIN_AN4 AIN_4P +#define PIN_AN5 AIN_5P +#define BOARD_NAME "MAX32600MBED" + +#define PIN_CS_TFT P2_3 // D10 PTD0 +#define PIN_DC_TFT P2_4 // D9 PTD5 +#define PIN_CS_TSC P2_5 // D8 PTA13 +#define PIN_BL_TFT P1_7 // D7 PTC9 +#define PIN_CS_SD P1_4 // D4 PTA4 +#define PIN_TSC_INTR P5_4 // PTC9 /* place holder */ +#define PIN_RESET_TFT P5_5 /// PTB10 /* place holder */ +#define PIN_ADC_CH0 AIN_0P // A0 PTB0 +#define PIN_ADC_CH1 AIN_2P // A2 PTB2 + #else #error TARGET NOT DEFINED #define PIN_SCLK D13 @@ -106,7 +168,11 @@ // NOTE: in case MIN_INTERVAL is too small // the program hangs during ADC and timer interrupt +#if defined (TARGET_MAX32600MBED) +#define MIN_INTERVAL 60 +#else #define MIN_INTERVAL 30 +#endif #define MAX_INTERVAL 20000 #define NUM_MAX_MENU 20 #define NUM_MAX_ANALOG_CH 2