|
素人質問も申し訳ありません CORONでフローと演算させたいのですがうまくいきません。ご教授お願いします。 付属の Ex05_AD_GET の main.c を以下のように修正しましたが動きません。 因みに x,y,z の設定、計算部分をコメントアウトすると動きます。 よろしくお願いいたします。 /***********---< TECHNO ROAD.inc >---***********/ /* */ /* [Coron sample programs] */ /* Ex05_AD_GET */ /* */ /* File :main.c */ /* Version :v1.0.1 */ /* Date :2009/06/19 */ /* Author :Norio Sakagami */ /* Description :Main protocol */ /* */ /***********************************************/ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_lib.h" #include "coron.h" #include "coron_init.h" #include "coron_wait.h" #include "coron_usbcdc.h" #include "coron_usbprint.h" #include "coron_ad.h" #include "usb_lib.h" #include "usb_prop.h" #include "usb_desc.h" #include "usb_pwr.h" #include <math.h> /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Extern variables ----------------------------------------------------------*/ //============================= // main関数 //============================= int main(void){ volatile double x; volatile double y; volatile double z; int temp; x = 1.0; y = 2.0; z = x + y; temp = (int)z; //Coronの初期化(メインクロックの設定,wait関連の設定,LD・SWの設定) coron_init(); //USB初期化 Set_USBClock(); USB_Interrupts_Config(); USB_Init(); //ADC初期化 AD_init(); //LED点灯 wait_timer(10000); //1sec待機 LD1_ON; //LD1を点灯 wait_timer(10000); //1sec待機 LD1_OFF; //LD1を消灯 LD2_ON; //LD2を点灯 wait_timer(10000); //1sec待機 LD2_OFF; //LD2を消灯 LD3_ON; //LD3を点灯 wait_timer(10000); //1sec待機 LD3_OFF; //LD3を消灯 //USB CDC put strings USB_puts("\r\n\n**** Test Program ****\r\n\n"); wait_timer(10000); //無限ループ while(1){ if(SW_USER==1){ //SW_USERが押されたら…(押す=1) USB_puts("\r\n\n**** Test Program ****\r\n\n"); LD1_ON; //LD1を点灯 USB_putn(ADC1ConvertedValue,5); //IOA0のAD値(12bit)を表示 USB_putn(temp,5); //IOA0のAD値(12bit)を表示 wait_timer(100); //少し間をおく USB_puts("\r\n"); //改行 wait_timer(100); //少し間をおく } else{ //SW_USERが押されていなかったら…(押さない=0) LD1_OFF; //LD2を消灯 } } return 0; } //====================================================== // End of Program //====================================================== |