チーム12A1

課題名

AD変換器の実装

研究者名

3年15組18番 佐藤圭太
3年15組54番 山田翔太

概要

値を表示する関数LCD_Char1_のAPI関数を使って10/16進数で
VRからの入力電圧をmV表示する。またバーグラフ表示をする

装置

・PSoC
・LCD
・ジャンパ(1本)

ソース


#include <device.h>
int16 adcResult = 0;
int16 mv_result = 0; 
void main()
{
 /* Place your initialization/startup code here (e.g. MyInst_Start()) */
   unsigned char j = 50;
   /* CYGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */
   LCD_Char_1_Start();
   
   ADC_DelSig_1_Start();
   ADC_DelSig_1_StartConvert();
   for(;;)
   {
       /* Place your application code here. */
       if(ADC_DelSig_1_IsEndConversion(ADC_DelSig_1_WAIT_FOR_RESULT))
       {
           LCD_Char_1_PrintString("ADC : ");
           adcResult = ADC_DelSig_1_GetResult16();
           mv_result = ADC_DelSig_1_CountsTo_mVolts(adcResult);
           LCD_Char_1_Position(0, 6);
           LCD_Char_1_PrintNumber(mv_result);
           LCD_Char_1_PrintString("mV ");
           LCD_Char_1_Position(1, 0);
           LCD_Char_1_PrintString("Gain:");
           LCD_Char_1_DrawHorizontalBG(1, 6, 16, adcResult/81);
           CyDelay(j);
           LCD_Char_1_ClearDisplay();
       }
   }
}

/* [] END OF FILE */

考察


加速度センサーを用いて電圧表示を行ってみたが、電圧を0にすることができなかった。
つまみで電圧を操作する場合は電圧を遮断できるが、センサーを用いると人の手による
ものなので完全に遮断することは不可能であるためであると考えられる。

  • 最終更新:2012-11-05 16:59:12

このWIKIを編集するにはパスワード入力が必要です

認証パスワード