Temporary Connector Reversed Version

Dependencies:   UniGraphic mbed vt100

afero_poc15_180403R , J1 のピン配置を反転させたヴァージョンです。

Color2系を使用するためには以下のピンをジャンパで接続してください。
J1-D7 <-> J1-D0
J1-D6 <-> J1-D1

(調査中) また、こちらでテストした範囲では、
FRDM-KL25Z の V3.3 を、Modulo2 の VCC_3V3 ピンに接続してやる必要がありました。

尚、J1-D1, D0 を使用するために UART を無効にしているため
ログは表示されません。

TFTモジュールについて 
aitendoのTFTモジュールはデフォルトでは8bit bus モードになっています。
/media/uploads/Rhyme/img_2364.jpg

半田のジャンパを変えて、SPIの設定にしてください。
/media/uploads/Rhyme/img_2363.jpg

サーミスタについて
POC1.5 では サーミスタは 25℃の時に抵抗値が 50.0kΩになる502AT-11 が
4.95kΩのプルアップ(実際は10kΩx2の並列)で使用されていました。

今回の試作では抵抗値が 10.0kΩの 103AT-11 が
5.1kΩのプルアップで使用されていますので、係数を合わせるために
SMTC502AT-11 のコンストラクタを 
R0 = 10.0
R1 = 5.1
B = 3435
T0 = 298.15
で呼ぶように変更しました。

Committer:
Rhyme
Date:
Tue Apr 24 12:18:10 2018 +0000
Revision:
1:6c54dc8acf96
Parent:
0:0b6732b53bf4
to adjust with 103AT-11 with 5.1k pull-up, the constructor of 502AT-11 is called with R0=10.0, R1=5.1, B=3435, T0=298.15

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:0b6732b53bf4 1 #include "mbed.h"
Rhyme 0:0b6732b53bf4 2 #include "PSE530.h"
Rhyme 0:0b6732b53bf4 3
Rhyme 0:0b6732b53bf4 4 /**
Rhyme 0:0b6732b53bf4 5 * SMC PSE530 pressure sensor
Rhyme 0:0b6732b53bf4 6 * analog output 1.0V - 5.0V
Rhyme 0:0b6732b53bf4 7 * 1.0V : 0
Rhyme 0:0b6732b53bf4 8 * 5.0V : 1MPa
Rhyme 0:0b6732b53bf4 9 * (at 0.6V : -0.1MPa)
Rhyme 0:0b6732b53bf4 10 * Our sensor I/F converts 0-5V to 0-3V
Rhyme 0:0b6732b53bf4 11 * So we suppose V = Analog Float Value : Pressure
Rhyme 0:0b6732b53bf4 12 * 0.6V = 0.2 : 0
Rhyme 0:0b6732b53bf4 13 * 3.0V = 1.0 : 1MPa
Rhyme 0:0b6732b53bf4 14 */
Rhyme 0:0b6732b53bf4 15
Rhyme 0:0b6732b53bf4 16 /**
Rhyme 0:0b6732b53bf4 17 * conversion from Pa to kgf/cm2
Rhyme 0:0b6732b53bf4 18 * 98,066.5 Pa = 1 kgf/cm2
Rhyme 0:0b6732b53bf4 19 * 1 Pa = 1 / 98066.6 kgf/cm2
Rhyme 0:0b6732b53bf4 20 */
Rhyme 0:0b6732b53bf4 21
Rhyme 0:0b6732b53bf4 22 PSE530::PSE530(AnalogIn *ain)
Rhyme 0:0b6732b53bf4 23 {
Rhyme 0:0b6732b53bf4 24 _ain = ain ;
Rhyme 0:0b6732b53bf4 25 }
Rhyme 0:0b6732b53bf4 26
Rhyme 0:0b6732b53bf4 27 PSE530::~PSE530(void)
Rhyme 0:0b6732b53bf4 28 {
Rhyme 0:0b6732b53bf4 29 if (_ain) {
Rhyme 0:0b6732b53bf4 30 delete _ain ;
Rhyme 0:0b6732b53bf4 31 }
Rhyme 0:0b6732b53bf4 32 }
Rhyme 0:0b6732b53bf4 33
Rhyme 0:0b6732b53bf4 34 /**
Rhyme 0:0b6732b53bf4 35 * On FRDM-KL25Z ADC's AREF is about 3.28V
Rhyme 0:0b6732b53bf4 36 * Where the converted pressure output is 0 to 3.21V
Rhyme 0:0b6732b53bf4 37 * So we must map ADC output 0 to 3.21/3.28 as full scale
Rhyme 0:0b6732b53bf4 38 *
Rhyme 0:0b6732b53bf4 39 * Then according to the datasheet of PSE530
Rhyme 0:0b6732b53bf4 40 * when full range is 0V to 5V
Rhyme 0:0b6732b53bf4 41 * 1V is 0 and 5V is 1MPa which is converted to
Rhyme 0:0b6732b53bf4 42 * 0.642/3.28 to 3.21/3.28 ~ 0.195731 to 0.9786585.
Rhyme 0:0b6732b53bf4 43 * The linear equation of
Rhyme 0:0b6732b53bf4 44 * y = a x + b
Rhyme 0:0b6732b53bf4 45 * 0 = a * 0.195731 + b
Rhyme 0:0b6732b53bf4 46 * 1 = a * 0.978658 + b
Rhyme 0:0b6732b53bf4 47 * results a = 1.277, b = -0.250
Rhyme 0:0b6732b53bf4 48 */
Rhyme 0:0b6732b53bf4 49 float PSE530::getPressure(void)
Rhyme 0:0b6732b53bf4 50 {
Rhyme 0:0b6732b53bf4 51 float coef_A = 1.277 ;
Rhyme 0:0b6732b53bf4 52 float coef_B = -0.250 ;
Rhyme 0:0b6732b53bf4 53 float av = 0.0 ;
Rhyme 0:0b6732b53bf4 54 float value = 0.0 ;
Rhyme 0:0b6732b53bf4 55 av = coef_A * _ain->read() + coef_B ;
Rhyme 0:0b6732b53bf4 56 // printf("Pressure ADC = %.4f\n", av) ;
Rhyme 0:0b6732b53bf4 57 value = 1000000 * av ; /* 1MPa at 1.0 */
Rhyme 0:0b6732b53bf4 58 value = value / 98066.5 ; /* Pa -> kgf/cm2 */
Rhyme 0:0b6732b53bf4 59 return( value ) ;
Rhyme 0:0b6732b53bf4 60 }