JP6060887B2 - Physical quantity sensor - Google Patents

Physical quantity sensor Download PDF

Info

Publication number
JP6060887B2
JP6060887B2 JP2013256970A JP2013256970A JP6060887B2 JP 6060887 B2 JP6060887 B2 JP 6060887B2 JP 2013256970 A JP2013256970 A JP 2013256970A JP 2013256970 A JP2013256970 A JP 2013256970A JP 6060887 B2 JP6060887 B2 JP 6060887B2
Authority
JP
Japan
Prior art keywords
clock
communication
cycle
physical quantity
processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2013256970A
Other languages
Japanese (ja)
Other versions
JP2015114884A (en
Inventor
政裕 神谷
政裕 神谷
利恭 酒井
利恭 酒井
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Denso Corp
Original Assignee
Denso Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Denso Corp filed Critical Denso Corp
Priority to JP2013256970A priority Critical patent/JP6060887B2/en
Publication of JP2015114884A publication Critical patent/JP2015114884A/en
Application granted granted Critical
Publication of JP6060887B2 publication Critical patent/JP6060887B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Arrangements For Transmission Of Measured Signals (AREA)
  • Information Transfer Systems (AREA)

Description

本発明は、物理量を示すセンサ信号に応じたデジタルデータを生成し、その生成したデジタルデータをホストに送信する物理量センサに関する。   The present invention relates to a physical quantity sensor that generates digital data corresponding to a sensor signal indicating a physical quantity and transmits the generated digital data to a host.

従来より、例えば加速度等の物理量を示すセンサ信号に応じたデジタルデータをホストに送信する物理量センサが供されている。ホストでは、物理量センサから受信したデジタルデータの経時変化を信号処理することで、例えば衝突等の事象を判定する。このような物理量センサがデジタルデータをホストに送信するシステムでは、センサ信号を取得する周期(サンプリング周期)と、そのセンサ信号に応じたデジタルデータをホストに送信する周期(送信周期)とが異なる可能性がある。これらの周期が異なると、センサ信号を取得するタイミングからデジタルデータを送信するタイミングまでの時間差にばらつきが発生する。時間差にばらつきが発生すると、センサ信号の送信抜けが発生したり、物理量の経時変化を示す波形(生の波形)とは異なる波形がホストに送信されたりする。その結果、物理量の経時変化をホストで正しく再現することができなくなり、誤判定が発生するという問題がある。このような問題に対し、特許文献1及び2では、センサ信号を取得する際に、センサ信号に応じたデジタルデータと共に、そのセンサ信号を取得した時刻を記録する手法が開示されている。   2. Description of the Related Art Conventionally, a physical quantity sensor is provided that transmits digital data corresponding to a sensor signal indicating a physical quantity such as acceleration to a host. In the host, for example, an event such as a collision is determined by performing signal processing on the change over time of the digital data received from the physical quantity sensor. In such a system in which the physical quantity sensor transmits digital data to the host, the cycle for acquiring the sensor signal (sampling cycle) may be different from the cycle for transmitting the digital data corresponding to the sensor signal (transmission cycle). There is sex. If these periods are different, the time difference from the timing of acquiring the sensor signal to the timing of transmitting the digital data varies. When the time difference varies, a sensor signal may be lost, or a waveform different from a waveform (raw waveform) indicating a change in physical quantity with time may be transmitted to the host. As a result, there is a problem that a change in physical quantity with time cannot be correctly reproduced by the host and erroneous determination occurs. In order to solve such a problem, Patent Documents 1 and 2 disclose a method of recording the time when the sensor signal is acquired together with digital data corresponding to the sensor signal when the sensor signal is acquired.

特開2006−322840号公報JP 2006-322840 A 特開2012−233841号公報JP 2012-233841 A

しかしながら、特許文献1及び2に開示されている手法では、センサ信号を取得した時刻を計測するための資源(手段)を必要とし、更にホストに送信するデータ量が増加し、通信速度の高速化を必要とする。その結果、コスト的に高価なシステムとなってしまう問題がある。又、センサ信号を例えば10[μs]程度の周期で取得する等してセンサ信号を取得する周期を高速化し、非同期の通信に対して常に最新のデジタルデータを用意することで、時間差のばらつきによる問題を解消することが可能である。ところが、これでは、センサ信号を必要以上に取得することになり、この場合もコスト面等から現実的ではない。又、単純にホストからコマンドを受信するタイミングにセンサ信号を取得するタイミングを同期させる方法も考えられる。ところが、ホストからコマンドを受信する通信周期が速くなると、1周期内で処理を完了できなくなり、センサ信号の取得ができなくなったり、センサ信号を例えばデジタルフィルタ処理する場合には当該デジタルフィルタ処理を完了できなくなったりする。又、最悪の場合、プログラムが暴走したりする可能性もあり得る。又、センサ信号の取得やデジタルフィルタ処理ができなくなると、センサ信号の連続性が途絶えてしまうので、デジタルフィルタ処理の演算結果として正しい演算結果が得られなくなる。   However, the methods disclosed in Patent Documents 1 and 2 require resources (means) for measuring the time when the sensor signal is acquired, further increases the amount of data transmitted to the host, and increases the communication speed. Need. As a result, there is a problem that the system becomes costly. In addition, the sensor signal is acquired at a cycle of about 10 [μs], for example, so that the sensor signal is acquired at high speed, and the latest digital data is always prepared for asynchronous communication. The problem can be solved. However, in this case, sensor signals are acquired more than necessary, and this case is also not practical from the viewpoint of cost. In addition, a method of simply synchronizing the timing of acquiring a sensor signal with the timing of receiving a command from the host is also conceivable. However, if the communication cycle for receiving a command from the host becomes faster, the processing cannot be completed within one cycle, the sensor signal cannot be obtained, or the digital filter processing is completed when the sensor signal is subjected to digital filter processing, for example. It becomes impossible. In the worst case, the program may run out of control. Further, if the sensor signal cannot be obtained or the digital filter processing cannot be performed, the continuity of the sensor signal is interrupted, so that a correct calculation result cannot be obtained as the calculation result of the digital filter processing.

本発明は、上記した事情に鑑みてなされたものであり、その目的は、新たな資源を必要とせず且つコスト高になることもなく、しかも、ホストからコマンドを受信する通信周期が速くなったとしても、物理量の経時変化を示す波形と一致する波形をホストに送信することができ、ホストでの誤判定の発生を未然に防止することができる物理量センサを提供することにある。   The present invention has been made in view of the above-described circumstances, and the object thereof is that a new resource is not required and the cost is not increased, and the communication cycle for receiving a command from the host is increased. However, an object of the present invention is to provide a physical quantity sensor that can transmit to the host a waveform that coincides with a waveform indicating a change in physical quantity with time, and can prevent erroneous determinations from occurring in the host.

請求項1に記載した発明によれば、データ処理手段は、クロック生成手段により生成されたクロックを動作クロックとし、センサ素子から物理量を示すセンサ信号を取得し、その取得したセンサ信号に応じたデジタルデータを記憶手段に格納するデータ更新処理を実行する。又、データ処理手段は、ホストからのコマンドが通信手段に受信されたことを契機とし、記憶手段に格納されているデジタルデータを通信手段からホストに送信させるデータ送信処理を実行する。ここで、データ処理手段は、ホストからのコマンドが通信手段に受信された周期を通信周期として計測し、データ更新処理に費やすデータ更新処理時間が通信周期に同調して一定となるように、クロック生成手段から出力される(供給される)クロックの周波数の調整をクロック制御手段に行わせる。   According to the first aspect of the present invention, the data processing means uses the clock generated by the clock generation means as an operation clock, acquires a sensor signal indicating a physical quantity from the sensor element, and performs digital processing according to the acquired sensor signal. Data update processing for storing data in the storage means is executed. The data processing means executes data transmission processing for transmitting the digital data stored in the storage means from the communication means to the host when the command from the host is received by the communication means. Here, the data processing means measures the period at which the command from the host is received by the communication means as the communication period, and clocks so that the data update processing time spent for the data update process becomes constant in synchronization with the communication period. The clock control unit adjusts the frequency of the clock output (supplied) from the generation unit.

これにより、データ更新処理時間が通信周期に同調して一定となるようにクロックの周波数の調整を行うことで、センサ信号を取得するタイミングからデジタルデータを送信するタイミングまでの時間差のばらつきの発生を未然に防止することができ、その時間差を一定とすることができる。その結果、センサ信号の送信抜けが発生することなく、物理量の経時変化を示す波形(生の波形)と一致する波形をホストに送信することができ、ホストでの誤判定の発生を未然に防止することができる。この場合、クロックの周波数の調整を行えば良いので、センサ信号を取得した時刻を計測するための資源(手段)を必要とせず、更にホストに送信するデータ量が増加することもない。よって、新たな資源を必要とせず且つコスト高になることもなく、容易に実現することができる。   As a result, by adjusting the clock frequency so that the data update processing time is constant in synchronization with the communication cycle, the time difference from the sensor signal acquisition timing to the digital data transmission timing can be changed. This can be prevented and the time difference can be made constant. As a result, it is possible to transmit to the host a waveform that matches the waveform (raw waveform) that shows the change in physical quantity over time without causing the sensor signal to be lost. can do. In this case, since the clock frequency may be adjusted, resources (means) for measuring the time when the sensor signal is acquired are not required, and the amount of data transmitted to the host does not increase. Therefore, it can be easily realized without requiring new resources and without increasing costs.

又、通信周期が速くなると、通信周期が速くなった直後では、センサ信号の取得ができなくなったり、センサ信号を例えばデジタルフィルタ処理する場合には当該デジタルフィルタ処理を完了できなくなったりする可能性がある。この点に関し、データ更新処理をホストとの通信と同期せずに(非同期で)実行するので、データ更新処理を通信周期の高速化に拘らず継続して実行することができる。そして、通信周期が速くなったことに対応し、クロックの周波数を高速化することで、データ更新処理での命令量を増加させることができ、ホストから次のコマンドが受信されたときにはセンサ信号の取得やデジタル処理を完了できるようになる。その結果、それ以降で、データ更新処理を通信周期に追従して実行することができ、ロバスト性を高めることができる。   Also, if the communication cycle becomes fast, there is a possibility that the sensor signal cannot be acquired immediately after the communication cycle becomes fast, or that the digital filter processing cannot be completed when the sensor signal is subjected to digital filter processing, for example. is there. In this regard, since the data update process is executed without being synchronized (asynchronously) with the communication with the host, the data update process can be continuously executed regardless of the speed of the communication cycle. In response to the faster communication cycle, the clock frequency can be increased to increase the amount of instructions in the data update process. When the next command is received from the host, the sensor signal Acquisition and digital processing can be completed. As a result, after that, the data update process can be executed following the communication cycle, and the robustness can be improved.

本発明の第1の施形態を示す機能ブロック図Functional block diagram showing a first embodiment of the present invention センサ信号及びデジタルデータの流れを示す図Diagram showing the flow of sensor signals and digital data 周回処理のフローチャートCirculation process flowchart 割り込み処理のフローチャートInterrupt processing flowchart タイミングチャートTiming chart センサ信号の取得タイミングを示す波形とデジタルデータの送信タイミングを示す波形との関係を示す図The figure which shows the relationship between the waveform which shows the acquisition timing of a sensor signal, and the waveform which shows the transmission timing of digital data 第2の実施形態を示す割り込み処理のフローチャートFlowchart of interrupt processing showing the second embodiment 周期帯域毎の上限及び下限を示す図Diagram showing upper and lower limits for each periodic band 第3の実施形態を示す周回処理のフローチャートFlow chart of the circulation process showing the third embodiment タイミングチャートTiming chart

(第1の実施形態)
以下、本発明を、自動車に搭載される自動車用加速度センサ(以下、加速度センサ)に適用した第1の実施形態について図1から図6を参照して説明する。図1に示すように、加速度センサ1(物理量センサ)は、センサ素子2と、制御装置3とを有する。センサ素子2は、被検出対象として自動車に与えられた加速度(物理量)を検出し、その検出した加速度を示すセンサ信号(アナログ信号)を制御装置3に出力する。
(First embodiment)
Hereinafter, a first embodiment in which the present invention is applied to an automobile acceleration sensor (hereinafter referred to as an acceleration sensor) mounted on an automobile will be described with reference to FIGS. 1 to 6. As shown in FIG. 1, the acceleration sensor 1 (physical quantity sensor) includes a sensor element 2 and a control device 3. The sensor element 2 detects an acceleration (physical quantity) given to the automobile as a detection target, and outputs a sensor signal (analog signal) indicating the detected acceleration to the control device 3.

制御装置3は、発振回路4と、クロック生成回路5(クロック生成手段)と、クロック制御回路6(クロック制御手段)と、アナログ信号処理部7と、マイコン8とを有する。発振回路4は、所定の発振周波数の発振信号をクロック生成回路5に出力する。クロック生成回路5は、発振回路4から所定の発振周波数の発振信号を入力すると、その入力した発振信号から所定の周波数のクロックを生成し、その生成したクロックをセンサ素子2、アナログ信号処理部7及びマイコン8に出力する。本実施形態では、クロック生成回路5からセンサ素子2へのクロックの信号線の一部と、クロック生成回路5からアナログ信号処理部7への信号線の一部とが共通である。即ち、クロック生成回路5からセンサ素子2に出力されるクロックの周波数と、クロック生成回路5からアナログ信号処理部7に出力されるクロックの周波数とは同じである。尚、クロック生成回路5からセンサ素子2及びアナログ信号処理部7へのクロックの信号線と、クロック生成回路5からマイコン8へのクロックの信号線とが別々である。そのため、クロック生成回路5からセンサ素子2及びアナログ信号処理部7に出力されるクロックの周波数と、クロック生成回路5からマイコン8に出力されるクロックの周波数とが異なっても良い。又、クロック生成回路5からセンサ素子2へのクロックの信号線と、クロック生成回路5からアナログ信号処理部7へのクロックの信号線とが別々にされても良い。その場合、クロック生成回路5からセンサ素子2に出力されるクロックの周波数と、クロック生成回路5からアナログ信号処理部7に出力されるクロックの周波数とが異なっても良い。クロック生成回路5からセンサ素子2、アナログ信号処理部7及びマイコン8に出力されるクロックは、それぞれの動作クロックとして用いられる。クロック制御回路6は、クロック生成回路5から出力されるクロックの周波数を、マイコン8のCPU(Central Processing Unit)11(データ処理手段)から入力する命令にしたがって調整する。   The control device 3 includes an oscillation circuit 4, a clock generation circuit 5 (clock generation unit), a clock control circuit 6 (clock control unit), an analog signal processing unit 7, and a microcomputer 8. The oscillation circuit 4 outputs an oscillation signal having a predetermined oscillation frequency to the clock generation circuit 5. When an oscillation signal having a predetermined oscillation frequency is input from the oscillation circuit 4, the clock generation circuit 5 generates a clock having a predetermined frequency from the input oscillation signal, and the generated clock is used as the sensor element 2 and the analog signal processing unit 7. And output to the microcomputer 8. In this embodiment, a part of the signal line of the clock from the clock generation circuit 5 to the sensor element 2 and a part of the signal line from the clock generation circuit 5 to the analog signal processing unit 7 are common. That is, the frequency of the clock output from the clock generation circuit 5 to the sensor element 2 and the frequency of the clock output from the clock generation circuit 5 to the analog signal processing unit 7 are the same. A clock signal line from the clock generation circuit 5 to the sensor element 2 and the analog signal processing unit 7 and a clock signal line from the clock generation circuit 5 to the microcomputer 8 are separate. Therefore, the frequency of the clock output from the clock generation circuit 5 to the sensor element 2 and the analog signal processing unit 7 may be different from the frequency of the clock output from the clock generation circuit 5 to the microcomputer 8. The clock signal line from the clock generation circuit 5 to the sensor element 2 and the clock signal line from the clock generation circuit 5 to the analog signal processing unit 7 may be provided separately. In that case, the frequency of the clock output from the clock generation circuit 5 to the sensor element 2 may be different from the frequency of the clock output from the clock generation circuit 5 to the analog signal processing unit 7. Clocks output from the clock generation circuit 5 to the sensor element 2, the analog signal processing unit 7, and the microcomputer 8 are used as respective operation clocks. The clock control circuit 6 adjusts the frequency of the clock output from the clock generation circuit 5 according to a command input from a CPU (Central Processing Unit) 11 (data processing means) of the microcomputer 8.

アナログ信号処理部7は、アンプ9と、AD変換回路10とを有する。アンプ9は、センサ素子2からセンサ信号を入力すると、その入力したセンサ信号を電圧増幅してAD変換回路10に出力する。AD変換回路10は、アンプ9から電圧増幅後のセンサ信号をアナログ信号として入力すると、その入力した電圧増幅後のセンサ信号をアナログ信号からデジタル信号に変換する。そして、AD変換回路10は、その電圧増幅後のセンサ信号をデジタル信号としてマイコン8に出力する。   The analog signal processing unit 7 includes an amplifier 9 and an AD conversion circuit 10. When receiving a sensor signal from the sensor element 2, the amplifier 9 amplifies the input sensor signal and outputs the amplified signal to the AD conversion circuit 10. When the AD signal is input from the amplifier 9 as an analog signal, the AD converter circuit 10 converts the input sensor signal after voltage amplification from an analog signal to a digital signal. Then, the AD conversion circuit 10 outputs the sensor signal after the voltage amplification to the microcomputer 8 as a digital signal.

マイコン8は、CPU11と、通信回路12(通信手段)と、タイマ13と、メモリ14(記憶手段)と、演算回路15とを有する。CPU11は、メモリ14に格納されているコンピュータプログラムを実行することで、本発明に関連する処理として、データ更新処理及びデータ送信処理を実行する。CPU11は、データ更新処理として、クロック生成回路5からマイコン8に出力される(供給される)クロックを動作クロックとし、アナログ信号処理部7(AD変換回路10)から電圧増幅後のセンサ信号をデジタル信号として入力すると、その入力したセンサ信号をデジタルフィルタ処理(演算処理)してデジタルデータ(演算結果)を生成する。そして、CPU11は、その生成したデジタルデータをメモリ14に一時的に格納する。この場合、CPU11は、演算指令を演算回路15に出力することで、デジタルフィルタ処理のための積算、加算、引算等の各種の演算を演算回路15により実施する。   The microcomputer 8 includes a CPU 11, a communication circuit 12 (communication means), a timer 13, a memory 14 (storage means), and an arithmetic circuit 15. The CPU 11 executes a computer program stored in the memory 14 to execute a data update process and a data transmission process as processes related to the present invention. As data update processing, the CPU 11 uses the clock output (supplied) from the clock generation circuit 5 to the microcomputer 8 as an operation clock, and digitally outputs the sensor signal after voltage amplification from the analog signal processing unit 7 (AD conversion circuit 10). When input as a signal, the input sensor signal is subjected to digital filter processing (calculation processing) to generate digital data (calculation result). Then, the CPU 11 temporarily stores the generated digital data in the memory 14. In this case, the CPU 11 outputs a calculation command to the calculation circuit 15 so that the calculation circuit 15 performs various calculations such as integration, addition, and subtraction for digital filter processing.

又、CPU11は、データ送信処理として、ホスト16からのコマンドが通信回路12に受信されると、そのコマンドの受信完了を契機とし(コマンドが受信されたことを契機とし)、メモリ14に一時的に格納されているデジタルデータを、ホスト16から通信回路12に受信されたクロックに追従して通信回路12からホスト16に送信させる。ホスト16は、電子制御装置(ECU:Electronic Control Unit)であり、加速度センサ1から受信したデジタルデータの経時変化を信号処理することで、例えば衝突等の事象を判定する。このようにCPU11は、クロック生成回路5から出力されるクロックを動作クロックとし、データ更新処理を実行する一方、ホスト16からのコマンドの受信完了を契機とし、データ送信処理を実行する。即ち、CPU11は、データ更新処理とデータ送信処理とを非同期で実行する。尚、図2に、センサ素子2からセンサ信号が出力され、通信回路12からデジタルデータが送信されるまでの流れを示している。   Further, as a data transmission process, when a command from the host 16 is received by the communication circuit 12, the CPU 11 triggers the completion of reception of the command (triggered when the command is received) and temporarily stores it in the memory 14. The digital data stored in the communication circuit 12 is transmitted from the communication circuit 12 to the host 16 following the clock received by the communication circuit 12 from the host 16. The host 16 is an electronic control unit (ECU: Electronic Control Unit), and determines an event such as a collision, for example, by performing signal processing of a change over time of digital data received from the acceleration sensor 1. As described above, the CPU 11 uses the clock output from the clock generation circuit 5 as an operation clock to execute data update processing, and executes data transmission processing in response to completion of reception of a command from the host 16. That is, the CPU 11 executes the data update process and the data transmission process asynchronously. FIG. 2 shows a flow from when the sensor signal is output from the sensor element 2 to when the digital data is transmitted from the communication circuit 12.

上記したようにデータ更新処理とデータ送信処理とを非同期で実行する構成では、センサ信号を取得する周期(サンプリング周期)と、そのセンサ信号をデジタルフィルタ処理したデジタルデータをホスト16に送信する周期(送信周期)とが異なる可能性がある。これらの周期が異なると、センサ信号を取得するタイミングからデジタルデータを送信するタイミングまでの時間差にばらつきが発生する可能性がある。時間差にばらつきが発生すると、センサ信号の送信抜けが発生したり、加速度の経時変化を示す波形(生の波形)とは異なる波形がホスト16に送信されたりする。その結果、加速度の経時変化をホスト16で正しく再現することができなくなり、ホスト16では、衝突等の判定を正しく行えなくなる。このような事情を考慮し、本発明において、CPU11は、以下の処理を実行する。   As described above, in the configuration in which the data update process and the data transmission process are executed asynchronously, the period for acquiring the sensor signal (sampling period) and the period for transmitting the digital data obtained by digital filtering the sensor signal to the host 16 ( (Transmission cycle) may be different. If these periods are different, there is a possibility that the time difference from the timing of acquiring the sensor signal to the timing of transmitting the digital data may vary. When the time difference varies, the sensor signal may be lost, or a waveform different from the waveform indicating the change in acceleration over time (raw waveform) may be transmitted to the host 16. As a result, the change in acceleration with time cannot be correctly reproduced by the host 16, and the host 16 cannot correctly determine a collision or the like. Considering such circumstances, in the present invention, the CPU 11 executes the following processing.

次に、上記した構成の作用について、図3から図6も参照して説明する。CPU11は、データ更新処理を周回処理(第1の周回処理)により実行し、データ送信処理を周回処理に対する割り込み処理により実行する。以下、周回処理及び割り込み処理についてそれぞれ説明する。   Next, the operation of the above-described configuration will be described with reference to FIGS. The CPU 11 executes the data update process by a loop process (first loop process), and executes the data transmission process by an interrupt process for the loop process. Hereinafter, each of the circulation process and the interrupt process will be described.

(1)周回処理
CPU11は、周回処理を開始すると、データ更新処理を実行する。即ち、CPU11は、アナログ信号処理部7から電圧増幅後のセンサ信号をデジタル信号として入力する(取得する)(S1)。次いで、CPU11は、その入力したセンサ信号をデジタルフィルタ処理してデジタルデータを生成する(S2)。次いで、CPU11は、デジタルフィルタ処理を完了すると、その生成したデジタルデータをメモリ14に一時的に格納する(S3)。CPU11は、データ更新処理を完了すると、データ更新処理を含めて周回処理に費やす周回処理時間の調整を行う(S4)。CPU11は、周回処理時間の調整を完了すると、周回処理を終了する。尚、周回処理時間には、データ更新処理に費やすデータ更新処理時間も含まれる。
(1) Circulation process When the CPU 11 starts the circulation process, the CPU 11 executes a data update process. That is, the CPU 11 inputs (acquires) the sensor signal after voltage amplification from the analog signal processing unit 7 as a digital signal (S1). Next, the CPU 11 performs digital filter processing on the input sensor signal to generate digital data (S2). Next, when the digital filter processing is completed, the CPU 11 temporarily stores the generated digital data in the memory 14 (S3). When the CPU 11 completes the data update process, the CPU 11 adjusts the round processing time spent on the round process including the data update process (S4). When the CPU 11 completes the adjustment of the circulation processing time, the CPU 11 ends the circulation processing. The round processing time includes the data update processing time spent for the data update processing.

具体的に説明すると、CPU11は、周回処理に費やす周回処理時間を一定に保つために周回処理の最後に(デジタルデータをメモリ14に格納した後に)、タイマのカウント値から実行サイクル数を算出する。この場合、CPU11は、基準のサイクル数を「x」とした場合に、基準のサイクル数「x」を、割り込み処理の発生回数等を想定して最大のサイクル数として設定する。CPU11は、基準のサイクル数「x」に対して実際のサイクル数が不足した場合は、その不足分のサイクル数を空処理により挿入して埋める。又、CPU11は、想定外の割り込み処理等の影響により基準のサイクル数「x」に対して実際のサイクル数が超過した場合は、次のクロックの周波数の調整時に超過分の時間を補うために、クロック生成回路5からマイコン8に出力されるクロックの周波数を高速化する。CPU11は、周回処理に費やす周回処理時間を一定に保つことで、データ更新処理に費やすデータ更新処理時間を一定に保つことができる。   More specifically, the CPU 11 calculates the number of execution cycles from the count value of the timer at the end of the circulation processing (after storing the digital data in the memory 14) in order to keep the circulation processing time spent for the circulation processing constant. . In this case, when the reference cycle number is “x”, the CPU 11 sets the reference cycle number “x” as the maximum number of cycles assuming the number of occurrences of interrupt processing. When the actual number of cycles is insufficient with respect to the reference number of cycles “x”, the CPU 11 inserts and fills in the insufficient number of cycles by empty processing. Further, when the actual number of cycles exceeds the reference number of cycles “x” due to an unexpected interrupt process or the like, the CPU 11 compensates for the excess time when adjusting the frequency of the next clock. The frequency of the clock output from the clock generation circuit 5 to the microcomputer 8 is increased. The CPU 11 can keep the data update processing time spent for the data update processing constant by keeping the round processing time spent for the round processing constant.

(2)割り込み処理
CPU11は、上記した周回処理を実行中に、ホスト16からのコマンドが通信回路12に受信されたか否かを監視している。CPU11は、ホスト16からのコマンドが通信回路12に受信されると、そのコマンドの受信完了を契機とし、実行中の周回処理を中断し、割り込み処理を開始する。CPU11は、割り込み処理を開始すると、前回のコマンドの受信タイミング(前回の割り込み)から今回のコマンドの受信タイミング(今回の割り込み)までに経過した時間を通信周期として計測する(S11)。CPU11は、その計測した通信周期が予め設定している上限又は下限を超えているか否か(基準周期を基準とする所定の周期帯域内であるか否か)を判定する(S12)。基準周期とは、ホスト16がコマンドを送信する周期であり、ホスト16の設定に依存する周期である。
(2) Interrupt processing The CPU 11 monitors whether or not a command from the host 16 is received by the communication circuit 12 during execution of the above-described circulation processing. When the command from the host 16 is received by the communication circuit 12, the CPU 11 suspends the running round process and starts the interrupt process when the reception of the command is completed. When starting the interrupt process, the CPU 11 measures the time elapsed from the reception timing of the previous command (previous interrupt) to the reception timing of the current command (current interrupt) as a communication cycle (S11). The CPU 11 determines whether or not the measured communication cycle exceeds a preset upper limit or lower limit (whether it is within a predetermined cycle band with reference to the reference cycle) (S12). The reference period is a period in which the host 16 transmits a command and is a period depending on the setting of the host 16.

具体的に説明すると、例えばホスト16がコマンドを500[μs]周期で送信するように基準周期を500[μs]に設定している場合に、CPU11は、基準周期の±5%を上限及び下限として設定する場合であれば、上限を525[μs]に設定し、下限を475[μs]に設定する。尚、基準周期に対する上限及び下限は、システムで要求される精度により設定すれば良く、システムで要求される精度が相対的に高ければ、下限から上限までの範囲を相対的に狭く設定し、一方、システムで要求される精度が相対的に低ければ、下限から上限までの範囲を相対的に広く設定すれば良い。   More specifically, for example, when the reference period is set to 500 [μs] so that the host 16 transmits a command at a cycle of 500 [μs], the CPU 11 sets ± 5% of the reference period to an upper limit and a lower limit. In this case, the upper limit is set to 525 [μs] and the lower limit is set to 475 [μs]. The upper and lower limits for the reference cycle may be set according to the accuracy required by the system. If the accuracy required by the system is relatively high, the range from the lower limit to the upper limit is set relatively narrow, If the accuracy required by the system is relatively low, the range from the lower limit to the upper limit may be set relatively wide.

CPU11は、その計測した通信周期が上限及び下限を超えていない(下限から上限までの範囲内であり、所定の周期帯域内である)と判定すると(S12:NO)、メモリ14に一時的に格納しておいたデジタルデータを読出す。次いで、CPU11は、その読出したデジタルデータを、ホスト16から通信回路12に受信されたクロックに追従して通信回路12からホスト16に送信させる(S13)。次いで、CPU11は、命令をクロック制御回路6に出力し、クロックの周波数の調整をクロック制御回路6に行わせる(S14)。そして、CPU11は、クロックの周波数の調整を完了すると、割り込み処理を終了する。   When the CPU 11 determines that the measured communication cycle does not exceed the upper limit and the lower limit (within a range from the lower limit to the upper limit and within a predetermined cycle band) (S12: NO), the CPU 11 temporarily stores the memory cycle. Read stored digital data. Next, the CPU 11 transmits the read digital data from the communication circuit 12 to the host 16 following the clock received by the communication circuit 12 from the host 16 (S13). Next, the CPU 11 outputs an instruction to the clock control circuit 6 and causes the clock control circuit 6 to adjust the clock frequency (S14). Then, when completing the adjustment of the clock frequency, the CPU 11 ends the interrupt processing.

具体的に説明すると、CPU11は、周回処理の1周期に基準サイクル数「x」を処理可能となる周波数のクロックがクロック生成回路5からマイコン8に出力されるように、クロックの周波数の調整をクロック制御回路6に行わせる。CPU11は、基準のサイクル数「x」に対して下限から上限までの範囲内で超過した分がサイクル数「y」であり、実際のサイクル数が「x+y」である場合は、周回処理の1周期にサイクル数「x+y」を処理可能となる周波数のクロックがクロック生成回路5からマイコン8に出力されるように、クロックの周波数の調整をクロック制御回路6に行わせる。即ち、CPU11は、基準サイクル数「x」からの超過分を補うための高速クロックがクロック生成回路5からマイコン8に出力されるように、クロックの周波数の調整をクロック制御回路6に行わせる。   Specifically, the CPU 11 adjusts the frequency of the clock so that a clock having a frequency that allows the reference cycle number “x” to be processed in one cycle of the rounding process is output from the clock generation circuit 5 to the microcomputer 8. The clock control circuit 6 is made to perform. When the number of cycles exceeding the reference cycle number “x” within the range from the lower limit to the upper limit is the cycle number “y”, and the actual cycle number is “x + y”, the CPU 11 The clock control circuit 6 is caused to adjust the clock frequency so that a clock having a frequency capable of processing the cycle number “x + y” in a cycle is output from the clock generation circuit 5 to the microcomputer 8. That is, the CPU 11 causes the clock control circuit 6 to adjust the clock frequency so that the clock generation circuit 5 outputs the high-speed clock for compensating for the excess from the reference cycle number “x” to the microcomputer 8.

例えば基準周期が500[μs]、クロックの周波数が8[MHz]、周回処理の1周期のサイクル数が4000[サイクル]、このうち割り込み処理のサイクル数が50[サイクル]程度である場合に、1周期のサイクル数の不足分(余り分)が最大で100[サイクル]程度発生すると、CPU11は、この不足分を1周期の中で空処理により挿入して埋める。又、CPU11は、割り込み処理が過剰に発生すると、割り込み処理の50[サイクル]が超えることになり、上記した余り分があれば、その中で吸収可能である。一方、CPU11は、吸収不可能であれば、次のクロックの周波数の調整を行う際に、基準周期の500[μs]の期間内で(4000+50)[サイクル]を処理可能となる周波数のクロックがクロック生成回路5からマイコン8に出力されるように、クロックの周波数を8.1[MHz]に調整する。   For example, when the reference period is 500 [μs], the clock frequency is 8 [MHz], the cycle number of one cycle of the round process is 4000 [cycles], of which the interrupt process cycle number is about 50 [cycles], When a shortage (remainder) of the number of cycles in one cycle occurs at a maximum of about 100 [cycles], the CPU 11 inserts and fills this shortage by empty processing in one cycle. Further, if excessive interrupt processing occurs, the CPU 11 exceeds 50 [cycles] of interrupt processing, and if there is a surplus described above, it can be absorbed therein. On the other hand, if the CPU 11 cannot absorb, when adjusting the frequency of the next clock, the clock having a frequency that can process (4000 + 50) [cycle] within the period of 500 [μs] of the reference period is obtained. The clock frequency is adjusted to 8.1 [MHz] so as to be output from the clock generation circuit 5 to the microcomputer 8.

一方、CPU11は、その計測した通信周期が上限又は下限を超えている(下限から上限までの範囲外であり、所定の周期帯域外である)と判定すると(S12:YES)、エラー情報を、ホスト16から通信回路12に受信されたクロックに追従して通信回路12からホスト16に送信させ(エラー処理を実行し)(S15)、割り込み処理を終了する。   On the other hand, when the CPU 11 determines that the measured communication cycle exceeds the upper limit or the lower limit (out of the range from the lower limit to the upper limit and outside the predetermined cycle band) (S12: YES), the error information is Following the clock received from the host 16 to the communication circuit 12, the communication circuit 12 transmits the error to the host 16 (error processing is executed) (S15), and the interrupt processing ends.

CPU11は、以上に説明した周回処理及び割り込み処理を実行することで、図5に示すように、周回処理を開始した後に(t1)、ホスト16からのコマンドを受信完了すると、実行中の周回処理を中断し、割り込み処理を開始する(t2)。CPU11は、割り込み処理を開始すると、前回の割り込みから今回の割り込みまでの通信周期(T0)を計測する。次いで、CPU11は、前回の周回処理でメモリ14に一時的に格納しておいたデジタルデータを通信回路12からホスト16に送信させ、クロックの周波数の調整をクロック制御回路6に行わせる。CPU11は、クロックの周波数の調整を完了すると、割り込み処理を終了し、中断していた周回処理を再開する(t3)。CPU11は、周回処理を再開すると、センサ信号をデジタルフィルタ処理して生成したデジタルデータをメモリ14に一時的に格納し(更新し)、次のデジタルデータの送信に備える(t4)。そして、CPU11は、周回処理時間の調整を完了すると、今回の周回処理を終了し、次の周回処理を開始する(t5)。これ以降、CPU11は、周回処理及び割り込み処理を繰返して実行する(t6、t7以降)。   As shown in FIG. 5, the CPU 11 executes the circulation process and the interrupt process described above, and after starting the circulation process (t1), when the reception of the command from the host 16 is completed, the rotation process being executed is executed. And interrupt processing is started (t2). When starting the interrupt processing, the CPU 11 measures a communication cycle (T0) from the previous interrupt to the current interrupt. Next, the CPU 11 causes the communication circuit 12 to transmit the digital data temporarily stored in the memory 14 in the previous rounding process to the host 16 and causes the clock control circuit 6 to adjust the clock frequency. When completing the adjustment of the clock frequency, the CPU 11 ends the interrupt process and resumes the interrupted loop process (t3). When the CPU 11 resumes the circulation processing, the digital data generated by digital filter processing of the sensor signal is temporarily stored (updated) in the memory 14 to prepare for transmission of the next digital data (t4). Then, when the CPU 11 completes the adjustment of the circulation processing time, the CPU 11 ends the current circulation process and starts the next circulation process (t5). Thereafter, the CPU 11 repeatedly executes the circulation process and the interrupt process (after t6 and t7).

このようにデータ更新処理に費やすデータ更新処理時間が通信周期に同調して一定となるように、クロック生成回路5からマイコン8に出力されるクロックの周波数の調整を行う。その結果、センサ信号を取得するタイミングからデジタルデータを送信するタイミングまでの時間差のばらつきの発生を未然に防止することができ、その時間差を一定とすることができる。即ち、図6に示すように、クロックの周波数の調整を行わない従来では、サンプリング周期と送信周期とが異なる可能性があり、サンプリング周期と送信周期とが異なると、センサ信号の送信抜けが発生したり、加速度の経時変化を示す波形(生の波形)と一致しない波形をホスト16に送信してしまったりすることになる。これに対し、クロックの周波数の調整を行う本発明では、サンプリング周期と送信周期とが異なる可能性を解消したことで、センサ信号の送信抜けが発生することなく、加速度の経時変化を示す波形と一致する波形をホスト16に送信することができる。   In this way, the frequency of the clock output from the clock generation circuit 5 to the microcomputer 8 is adjusted so that the data update processing time spent for the data update processing becomes constant in synchronization with the communication cycle. As a result, it is possible to prevent the occurrence of variations in the time difference from the timing of acquiring the sensor signal to the timing of transmitting the digital data, and the time difference can be made constant. That is, as shown in FIG. 6, in the conventional case where the clock frequency is not adjusted, there is a possibility that the sampling period and the transmission period are different. If the sampling period and the transmission period are different, the transmission of the sensor signal is lost. Or a waveform that does not match the waveform (raw waveform) indicating the change over time in acceleration is transmitted to the host 16. In contrast, in the present invention that adjusts the frequency of the clock, the possibility that the sampling period and the transmission period are different is eliminated, so that a waveform indicating a change in acceleration with time can be obtained without causing a transmission loss of the sensor signal. A matching waveform can be transmitted to the host 16.

以上に説明したように第1の実施形態によれば、加速度センサ1において、ホスト16からのコマンドを受信完了すると、ホスト16からのコマンドが受信された周期を通信周期として計測し、データ更新処理に費やすデータ更新処理時間が当該計測した通信周期に同調して一定となるように、クロック生成回路5からマイコン8に出力されるクロックの周波数を調整するようにした。これにより、センサ信号を取得するタイミングからデジタルデータを送信するタイミングまでの時間差のばらつきの発生を未然に防止することができ、その時間差を一定とすることができる。その結果、センサ信号の送信抜けが発生することなく、加速度の経時変化を示す波形(生の波形)と一致する波形をホスト16に送信することができ、ホスト16での誤判定の発生を未然に防止することができる。この場合、クロックの周波数の調整を行えば良いので、センサ信号を取得した時刻を計測するための資源(手段)を必要とせず、更にホスト16に送信するデータ量も増加することもない。よって、新たな資源を必要とせず且つコスト高になることもなく、容易に実現することができる。   As described above, according to the first embodiment, when the acceleration sensor 1 completes reception of a command from the host 16, the period at which the command from the host 16 is received is measured as a communication period, and data update processing is performed. The frequency of the clock output from the clock generation circuit 5 to the microcomputer 8 is adjusted so that the data update processing time spent in the process becomes constant in synchronization with the measured communication cycle. Thereby, it is possible to prevent occurrence of variation in time difference from the timing of acquiring the sensor signal to the timing of transmitting the digital data, and the time difference can be made constant. As a result, it is possible to transmit to the host 16 a waveform that coincides with a waveform (raw waveform) indicating a change in acceleration with time without causing transmission loss of the sensor signal. Can be prevented. In this case, since it is sufficient to adjust the clock frequency, a resource (means) for measuring the time when the sensor signal is acquired is not required, and the amount of data transmitted to the host 16 does not increase. Therefore, it can be easily realized without requiring new resources and without increasing costs.

又、通信周期が速くなると、通信周期が速くなった直後ではセンサ信号の取得やデジタルフィルタ処理を完了できなくなる可能性がある。この点に関し、データ更新処理をホスト16との通信と同期せずに(非同期で)実行するので、データ更新処理を通信周期の高速化に拘らず継続して実行することができる。そして、通信周期が速くなったことに対応し、クロックの周波数を高速化することで、データ更新処理での命令量を増加させることができ、ホスト16からの次のコマンドが受信されたときにはセンサ信号の取得やデジタルフィルタ処理を完了できるようになる。その結果、それ以降で、データ更新処理を通信周期に追従して実行することができ、ロバスト性を高めることができる。   Also, if the communication cycle becomes faster, there is a possibility that sensor signal acquisition and digital filter processing cannot be completed immediately after the communication cycle becomes faster. In this regard, since the data update process is executed without being synchronized (asynchronously) with the communication with the host 16, the data update process can be continuously executed regardless of the speed of the communication cycle. In response to the faster communication cycle, the clock frequency can be increased to increase the amount of instructions in the data update process. When the next command from the host 16 is received, the sensor Signal acquisition and digital filter processing can be completed. As a result, after that, the data update process can be executed following the communication cycle, and the robustness can be improved.

又、ホスト16からのコマンドを受信するタイミングにセンサ信号を取得するタイミングを同期させる従来の想定される方法では、ホスト16からコマンドを受信することができないと、データ更新処理を開始することができない。又、ホスト16からのコマンドを受信することができない場合に備え、タイマを設け、タイムアウトした場合にデータ更新処理を開始することも想定される。ところが、これでは、データ更新処理を開始した後にホスト16からのコマンドを受信すると、実行中のデータ更新処理を中断して最初から再開することになるので、データ更新処理を正確に実行することができない可能性もある。このような従来の想定される方法で発生する問題に対しても、本発明では、データ更新処理をホスト16との通信と同期せずに実行するので、データ更新処理を継続して実行することができる。   Further, in the conventional assumed method of synchronizing the timing of acquiring the sensor signal with the timing of receiving the command from the host 16, the data update process cannot be started unless the command is received from the host 16. . It is also assumed that a timer is provided in case the command from the host 16 cannot be received, and the data update process is started when a timeout occurs. However, in this case, when a command from the host 16 is received after the data update process is started, the data update process being executed is interrupted and restarted from the beginning, so that the data update process can be executed accurately. It may not be possible. In order to cope with such a problem that occurs in the conventional method, in the present invention, the data update process is executed without being synchronized with the communication with the host 16, so that the data update process is continuously executed. Can do.

又、計測した通信周期が上限及び下限を超えていない場合に、データ送信処理を実行するようにした。これにより、通信周期の誤差をある程度の範囲まで許容した上で、デジタルデータをホスト16に送信することができる。その一方、計測した通信周期が上限又は下限を超えている場合に、データ送信処理を実行せず、エラー情報をホスト16に送信するようにした。これにより、通信周期の誤差がある程度の範囲を超えると、通信周期の誤差がある程度の範囲を超えたことをホスト16に通知することができる。又、発振回路4として、精度が相対的に高い高価な水晶発振器を用意する必要がなく、精度が相対的に低い安価なCR発振器で対応することができ、その分、コスト高を抑制することができる。   In addition, the data transmission process is executed when the measured communication cycle does not exceed the upper limit and the lower limit. As a result, the digital data can be transmitted to the host 16 while allowing the communication cycle error to a certain extent. On the other hand, when the measured communication cycle exceeds the upper limit or lower limit, the data transmission process is not executed and error information is transmitted to the host 16. Thus, when the communication cycle error exceeds a certain range, the host 16 can be notified that the communication cycle error has exceeded a certain range. Further, it is not necessary to prepare an expensive crystal oscillator with a relatively high accuracy as the oscillation circuit 4, and an inexpensive CR oscillator with a relatively low accuracy can be used, thereby suppressing the cost increase. Can do.

(第2の実施形態)
次に、本発明の第2の実施形態について、図7及び図8を参照して説明する。尚、上記した第1の実施形態と同一部分については説明を省略し、異なる部分について説明する。第1の実施形態は、1つの周期帯域に対応する構成であるが、第2の実施形態は、複数の周期帯域に対応する構成である。
(Second Embodiment)
Next, a second embodiment of the present invention will be described with reference to FIGS. In addition, description is abbreviate | omitted about the same part as above-mentioned 1st Embodiment, and a different part is demonstrated. The first embodiment is a configuration corresponding to one periodic band, but the second embodiment is a configuration corresponding to a plurality of periodic bands.

CPU11は、図8に示すように、例えば基準周期をそれぞれ500[μs]、250[μs]、125[μs]に設定している3つの周期帯域に対応可能とするように、それぞれの基準周期に対して上限及び下限を設定している。具体的には、CPU11は、500[μs]の基準周期に対して上限を525[μs]に設定すると共に下限を475[μs]に設定し、250[μs]の基準周期に対して上限を275[μs]に設定すると共に下限を225[μs]に設定し、125[μs]の基準周期に対して上限を150[μs]に設定すると共に下限を100[μs]に設定している。   As shown in FIG. 8, the CPU 11, for example, sets each reference period so that it can correspond to three period bands in which the reference periods are set to 500 [μs], 250 [μs], and 125 [μs], respectively. The upper and lower limits are set. Specifically, the CPU 11 sets the upper limit to 525 [μs] for the reference period of 500 [μs], sets the lower limit to 475 [μs], and sets the upper limit to the reference period of 250 [μs]. The lower limit is set to 225 [μs] and the upper limit is set to 150 [μs] and the lower limit is set to 100 [μs] with respect to the reference period of 125 [μs].

この場合、CPU11は、割り込み処理において、その計測した通信周期が上限又は下限を超えていると判定すると(S12:YES)、その計測した通信周期が別の周期帯域内であるか否かを判定する(S16)。CPU11は、その計測した通信周期が別の周期帯域内であると判定すると(S16:YES)、周期帯域の変更に伴う各種設定(定数等)を切替える(S17)。そして、CPU11は、クロックの周波数の調整をクロック制御回路6に行わせ(S14)、クロックの周波数の調整を完了すると、割り込み処理を終了する。   In this case, if the CPU 11 determines in the interrupt process that the measured communication cycle exceeds the upper limit or the lower limit (S12: YES), the CPU 11 determines whether or not the measured communication cycle is within another cycle band. (S16). When the CPU 11 determines that the measured communication period is within another period band (S16: YES), the CPU 11 switches various settings (constants, etc.) associated with the change of the period band (S17). Then, the CPU 11 causes the clock control circuit 6 to adjust the clock frequency (S14), and when the adjustment of the clock frequency is completed, the interrupt process is terminated.

一方、CPU11は、その計測した通信周期が別の周期帯域内でもないと判定すると(S16:NO)、エラー情報を、ホスト16から通信回路12に受信されたクロックに追従して通信回路12からホスト16に送信させ(エラー処理を実行し)(S15)、割り込み処理を終了する。尚、この場合、CPU11は、クロックの周波数の調整をクロック制御回路6に行わせないことで、通信周期が正常化すると、その直後に速やかに正常動作に復帰することができる。   On the other hand, if the CPU 11 determines that the measured communication period is not within another period band (S16: NO), the error information is sent from the communication circuit 12 following the clock received by the communication circuit 12 from the host 16. The data is transmitted to the host 16 (error processing is executed) (S15), and the interrupt processing is terminated. In this case, the CPU 11 does not adjust the clock frequency to the clock control circuit 6 so that the normal operation can be promptly restored immediately after the communication cycle is normalized.

具体的に説明すると、CPU11は、例えば基準周期を500[μs]として周期帯域を475から525[μs]の範囲に設定している場合に、計測した通信周期が例えば260[μs]であれば、その計測した通信周期が475から525[μs]の範囲外であるが、基準周期を250[μs]とする225から275[μs]の周期帯域内であるので、周期帯域の変更に伴う各種設定を切替え、クロックの周波数の調整をクロック制御回路6に行わせる。一方、CPU11は、計測した通信周期が例えば200[μs]であれば、何れの周期帯域内でもないので、エラー情報を通信回路12からホスト16に送信させる。尚、周期帯域が切替わる場合としては、1つのホスト16が周期帯域を動的に変化させる場合や、物理センサ1の通信相手先のホスト16が切替わる場合がある。   Specifically, for example, when the reference period is set to 500 [μs] and the period band is set in the range of 475 to 525 [μs], the CPU 11 has a measured communication period of, for example, 260 [μs]. The measured communication period is outside the range of 475 to 525 [μs], but is within the period band of 225 to 275 [μs] with the reference period being 250 [μs]. The setting is switched and the clock control circuit 6 adjusts the frequency of the clock. On the other hand, if the measured communication period is, for example, 200 [μs], the CPU 11 causes the error information to be transmitted from the communication circuit 12 to the host 16 because it is not in any period band. In addition, as a case where the periodic band is switched, there is a case where one host 16 dynamically changes the periodic band, or a case where the host 16 of the communication partner of the physical sensor 1 is switched.

以上に説明したように第2の実施形態によれば、上記した第1の実施形態で説明した効果と同等の効果を得ることができることに加え、計測した通信周期が別の周期帯域内である場合に、周期帯域の変更に伴う各種設定を切替え、クロックの周波数の調整を行うことで、基準周期の変化に対応することができる。   As described above, according to the second embodiment, in addition to being able to obtain the same effect as that described in the first embodiment, the measured communication period is within another periodic band. In this case, it is possible to cope with a change in the reference period by switching various settings accompanying the change in the period band and adjusting the clock frequency.

(第3の実施形態)
次に、本発明の第3の実施形態について、図9及び図10を参照して説明する。尚、上記した第1の実施形態と同一部分については説明を省略し、異なる部分について説明する。第3の実施形態は、周回処理の起点を通信周期と同期させる構成である。
(Third embodiment)
Next, a third embodiment of the present invention will be described with reference to FIGS. In addition, description is abbreviate | omitted about the same part as above-mentioned 1st Embodiment, and a different part is demonstrated. The third embodiment is configured to synchronize the starting point of the circulation processing with the communication cycle.

CPU11は、周回処理を開始すると、ホスト16からのコマンドを受信完了したか否かを判定すると共に(S21)、前回のコマンドを受信してからの経過時間が上限を超えたか否かを判定する(S22)。CPU11は、前回のコマンドを受信してからの経過時間が上限を超える前に、ホスト16からのコマンドを受信完了したと判定すると(S21:YES)、この場合も、前回のコマンドの受信タイミングから今回のコマンドの受信タイミングまでに経過した時間を通信周期として計測する(S23)。次いで、CPU11は、その計測した通信周期が予め設定している下限を超えているか否かを判定する(S24)。CPU11は、その計測した通信周期が下限を超えていないと判定すると(S24:NO)、メモリ14に一時的に格納しておいたデジタルデータを読出し、その読出したデジタルデータを、ホスト16から通信回路12に受信されたクロックに追従して通信回路12からホスト16に送信させる(S25)。そして、CPU11は、第1の実施形態と同様に、命令をクロック制御回路6に出力し、クロックの周波数の調整をクロック制御回路6に行わせる(S26)。   When starting the circulation process, the CPU 11 determines whether or not the command from the host 16 has been received (S21), and determines whether or not the elapsed time since the previous command was received exceeds the upper limit. (S22). If the CPU 11 determines that the reception of the command from the host 16 has been completed before the elapsed time from the reception of the previous command exceeds the upper limit (S21: YES), also in this case, from the reception timing of the previous command. The time elapsed until the reception timing of this command is measured as a communication cycle (S23). Next, the CPU 11 determines whether or not the measured communication cycle exceeds a preset lower limit (S24). When the CPU 11 determines that the measured communication cycle does not exceed the lower limit (S24: NO), the CPU 11 reads the digital data temporarily stored in the memory 14, and communicates the read digital data from the host 16. The communication circuit 12 is made to transmit to the host 16 following the clock received by the circuit 12 (S25). Then, as in the first embodiment, the CPU 11 outputs an instruction to the clock control circuit 6 and causes the clock control circuit 6 to adjust the clock frequency (S26).

CPU11は、クロックの周波数の調整を完了すると、アナログ信号処理部7から電圧増幅後のセンサ信号をデジタル信号として入力する(取得する)(S27)。次いで、CPU11は、その入力したセンサ信号をデジタルフィルタ処理してデジタルデータを生成する(S28)。そして、CPU11は、デジタルフィルタ処理を完了すると、その生成したデジタルデータをメモリ14に一時的に格納し(S29)、デジタルデータのメモリ14への格納を完了すると、周回処理を終了する。   When completing the adjustment of the clock frequency, the CPU 11 inputs (acquires) the sensor signal after voltage amplification from the analog signal processing unit 7 as a digital signal (S27). Next, the CPU 11 performs digital filter processing on the input sensor signal to generate digital data (S28). When the digital filter processing is completed, the CPU 11 temporarily stores the generated digital data in the memory 14 (S29), and when the digital data is completely stored in the memory 14, the circulation processing is terminated.

一方、CPU11は、ホスト16からのコマンドを受信完了する前に、前回のコマンドを受信してからの経過時間が上限を超えたと判定すると(S22:YES)、エラー情報を通信回路12からホスト16に送信させる(エラー処理を実行する)(S30)。そして、CPU11は、クロックの周波数の調整をクロック制御回路6に行わせる(S26)。CPU11は、基準サイクル数「x」に対して上限を超えて超過した分がサイクル数「m」であれば、次の周回処理の1周期にサイクル数「x+m」を処理可能となる周波数のクロックがクロック生成回路5からマイコン8に出力されるように調整を行わせることで、上限を超えて超過したサイクル数「m」も含めて次の通信周期の周期内で処理することができ、センサ信号の取得を一定周期で継続することができる。   On the other hand, if the CPU 11 determines that the elapsed time since the reception of the previous command has exceeded the upper limit before completing the reception of the command from the host 16 (S22: YES), error information is transmitted from the communication circuit 12 to the host 16. Are transmitted (error processing is executed) (S30). Then, the CPU 11 causes the clock control circuit 6 to adjust the clock frequency (S26). If the amount exceeding the upper limit with respect to the reference cycle number “x” exceeds the upper limit with respect to the reference cycle number “x”, the CPU 11 has a frequency clock that allows the cycle number “x + m” to be processed in one cycle of the next round process. Can be processed within the next communication cycle, including the number of cycles exceeding the upper limit “m”, by adjusting so that the clock is output from the clock generation circuit 5 to the microcomputer 8. The signal acquisition can be continued at a constant period.

又、CPU11は、計測した通信周期が下限を超えていると判定すると(S24:YES)、この場合も、エラー情報を通信回路12からホスト16に送信させる(S30)。そして、CPU11は、クロックの周波数の調整をクロック制御回路6に行わせる(S26)。CPU11は、基準サイクル数「x」に対して下限を超えて不足した分がサイクル数「n」であれば、次の周回処理の1周期にサイクル数「x−n」を処理可能となる周波数のクロックがクロック生成回路5からマイコン8に出力されるように調整を行わせることで、不足したサイクル数「n」も含めて通信周期の周期内で処理することができ、センサ信号の取得も一定周期で継続することができる。尚、この第3の実施形態では、周回処理の起点を通信周期と同期させているので、第1の実施形態で説明した周回処理時間を調整する処理(図3のS4に相当する処理)が不要となる。   If the CPU 11 determines that the measured communication cycle exceeds the lower limit (S24: YES), the CPU 11 also causes error information to be transmitted from the communication circuit 12 to the host 16 (S30). Then, the CPU 11 causes the clock control circuit 6 to adjust the clock frequency (S26). The CPU 11 can process the cycle number “xn” in one cycle of the next round process if the shortage exceeding the lower limit with respect to the reference cycle number “x” is the cycle number “n”. By adjusting so that the clock is output from the clock generation circuit 5 to the microcomputer 8, it is possible to process within the cycle of the communication cycle including the insufficient number of cycles “n”, and to acquire the sensor signal. It can be continued at a fixed period. In the third embodiment, since the starting point of the circulation processing is synchronized with the communication cycle, the processing for adjusting the circulation processing time described in the first embodiment (processing corresponding to S4 in FIG. 3) is performed. It becomes unnecessary.

CPU11は、以上に説明した周回処理を実行することで、図10に示すように、周回処理を開始すると(t11)、ホスト16からのコマンドの受信完了を待機し、ホスト16からのコマンドを受信完了すると(t12)、前回のコマンドの受信タイミングから今回のコマンドの受信タイミングまでの通信周期(T0)を計測する。次いで、CPU11は、前回の周回処理でメモリ14に一時的に格納しておいたデジタルデータを通信回路12からホスト16に送信させる(t13)。CPU11は、デジタルデータの送信を完了すると、クロックの周波数の調整をクロック制御回路6に行わせ、クロックの周波数の調整を完了すると、センサ信号を取得し、その取得したセンサ信号をデジタルフィルタ処理し、そのデジタルフィルタ処理により生成したデジタルデータをメモリ14に一時的に格納し(更新し)、次のデジタルデータの送信に備える(t14)。そして、CPU11は、今回の周回処理を終了し、次の周回処理を開始する(t15)。これ以降、CPU11は、周回処理を繰返して実行する(t16、t17以降)。   As shown in FIG. 10, the CPU 11 starts the circulation process by executing the circulation process described above (t11), waits for the completion of reception of the command from the host 16, and receives the command from the host 16. When completed (t12), the communication cycle (T0) from the previous command reception timing to the current command reception timing is measured. Next, the CPU 11 causes the communication circuit 12 to transmit the digital data temporarily stored in the memory 14 in the previous round process to the host 16 (t13). When the transmission of the digital data is completed, the CPU 11 causes the clock control circuit 6 to adjust the frequency of the clock. When the adjustment of the clock frequency is completed, the CPU 11 acquires the sensor signal and performs digital filter processing on the acquired sensor signal. The digital data generated by the digital filter processing is temporarily stored (updated) in the memory 14 to prepare for transmission of the next digital data (t14). Then, the CPU 11 ends the current round process and starts the next round process (t15). Thereafter, the CPU 11 repeatedly executes the circulation process (after t16, t17).

以上に説明したように第3の実施形態によれば、上記した第1の実施形態で説明した効果と同等の効果を得ることができることに加え、周回処理の起点を通信周期と同期させているので、第1の実施形態で説明した周回処理時間を調整する処理を不要とすることができる。   As described above, according to the third embodiment, the same effect as that described in the first embodiment can be obtained, and the starting point of the circulation processing is synchronized with the communication cycle. Therefore, the process for adjusting the round processing time described in the first embodiment can be made unnecessary.

(その他の実施形態)
本発明は、上記した実施形態にのみ限定されるものではなく、以下のように変形又は拡張することができる。又、複数の変形例を組み合わせても良い。
自動車用の加速度センサに適用することに限らず、自動車以外の用途として例えば二輪車の加速度センサに適用しても良い。加速度センサに適用することに限らず、例えば温度を検出する温度センサ、湿度を検出する湿度センサ等の各種のセンサに適用しても良い。
センサ信号をデジタルフィルタ処理してデジタルデータを生成することに限らず、センサ信号に対してデジタルフィルタ処理以外の別の処理を施しても良い。又、センサ信号をそのまま(処理を施すことなく)デジタルデータとしてメモリに格納しても良い。
(Other embodiments)
The present invention is not limited to the above-described embodiment, and can be modified or expanded as follows. A plurality of modified examples may be combined.
For example, the present invention may be applied to an acceleration sensor of a two-wheeled vehicle as an application other than that of an automobile. For example, the present invention may be applied to various sensors such as a temperature sensor that detects temperature and a humidity sensor that detects humidity.
The sensor signal is not limited to digital filtering to generate digital data, but other processing other than digital filtering may be performed on the sensor signal. Further, the sensor signal may be stored in the memory as digital data as it is (without being processed).

図面中、1は加速度センサ(物理量センサ)、2はセンサ素子、5はクロック生成回路(クロック生成手段)、6はクロック制御回路(クロック制御手段)、11はCPU(データ処理手段)、12は通信回路(通信手段)、14はメモリ(記憶手段)、16はホストである。   In the drawings, 1 is an acceleration sensor (physical quantity sensor), 2 is a sensor element, 5 is a clock generation circuit (clock generation means), 6 is a clock control circuit (clock control means), 11 is a CPU (data processing means), and 12 is A communication circuit (communication means), 14 is a memory (storage means), and 16 is a host.

Claims (8)

物理量を示すセンサ信号を出力するセンサ素子(2)と、
クロックを生成するクロック生成手段(5)と、
ホスト(16)との間で通信を行う通信手段(12)と、
前記クロックを動作クロックとし、前記センサ信号を取得し、その取得したセンサ信号に応じたデジタルデータを記憶手段(14)に格納するデータ更新処理を実行すると共に、前記ホストからのコマンドが前記通信手段に受信されたことを契機とし、前記記憶手段に格納されているデジタルデータを前記通信手段から前記ホストに送信させるデータ送信処理を実行するデータ処理手段(11)と、を備えた物理量センサ(1)において、
前記クロックの周波数の調整を行うクロック制御手段(6)を備え、
前記データ処理手段は、前記ホストからのコマンドが前記通信手段に受信された周期を通信周期として計測し、前記データ更新処理に費やすデータ更新処理時間が前記通信周期に同調して一定となるように前記クロックの周波数の調整を前記クロック制御手段に行わせることを特徴とする物理量センサ。
A sensor element (2) for outputting a sensor signal indicating a physical quantity;
Clock generation means (5) for generating a clock;
A communication means (12) for communicating with the host (16);
The clock is used as an operation clock, the sensor signal is acquired, a data update process is executed to store digital data corresponding to the acquired sensor signal in the storage means (14), and a command from the host is sent to the communication means The physical quantity sensor (1) includes: data processing means (11) for executing data transmission processing for transmitting the digital data stored in the storage means from the communication means to the host. )
A clock control means (6) for adjusting the frequency of the clock;
The data processing means measures a period at which a command from the host is received by the communication means as a communication period, so that a data update processing time spent for the data update process becomes constant in synchronization with the communication period. A physical quantity sensor characterized by causing the clock control means to adjust the frequency of the clock.
請求項1に記載した物理量センサにおいて、
前記データ処理手段は、第1の周回処理として、前記データ更新処理を実行した後に前記データ更新処理時間の調整を行い、前記ホストからのコマンドが前記通信手段に受信されたことを契機とし、前記第1の周回処理に対する割り込み処理として、前記通信周期を計測し、その計測した通信周期が基準周期を基準とする所定の周期帯域内である場合に、前記データ送信処理を実行し、前記データ更新処理時間が前記通信周期に同調して一定となるように前記クロックの周波数の調整を前記クロック制御手段に行わせることを特徴とする物理量センサ。
The physical quantity sensor according to claim 1,
The data processing means adjusts the data update processing time after executing the data update process as a first round process, and triggered by the command from the host being received by the communication means, As the interrupt processing for the first loop processing, the communication cycle is measured, and when the measured communication cycle is within a predetermined cycle band with reference to a reference cycle, the data transmission processing is executed, and the data update is performed. A physical quantity sensor characterized by causing the clock control means to adjust the frequency of the clock so that the processing time becomes constant in synchronization with the communication cycle.
請求項2に記載した物理量センサにおいて、
前記データ処理手段は、計測した通信周期が前記所定の周期帯域外である場合に、エラー処理を実行することを特徴とする物理量センサ。
The physical quantity sensor according to claim 2,
The physical quantity sensor according to claim 1, wherein the data processing means executes error processing when the measured communication cycle is outside the predetermined cycle band.
請求項2に記載した物理量センサにおいて、
前記データ処理手段は、計測した通信周期が前記所定の周期帯域外であり且つ別の基準周期を基準とする別の所定の周期帯域内である場合に、前記データ更新処理時間が前記別の通信周期に同調して一定となるように前記クロックの周波数の調整を前記クロック制御手段に行わせることを特徴とする物理量センサ。
The physical quantity sensor according to claim 2,
When the measured communication cycle is outside the predetermined cycle band and within another predetermined cycle band with another reference cycle as a reference, the data update processing time is longer than the other communication. A physical quantity sensor characterized by causing the clock control means to adjust the frequency of the clock so as to be constant in synchronization with a cycle.
請求項4に記載した物理量センサにおいて、
前記データ処理手段は、計測した通信周期が前記所定の周期帯域外であり且つ前記別の所定の周期帯域外である場合に、エラー処理を実行することを特徴とする物理量センサ。
The physical quantity sensor according to claim 4,
The physical quantity sensor, wherein the data processing means executes error processing when the measured communication period is outside the predetermined period band and outside the other predetermined period band.
請求項1に記載した物理量センサにおいて、
前記データ処理手段は、第2の周回処理として、前記ホストからのコマンドが前記通信手段に受信されたか否かを判定し、前記ホストからのコマンドが前記通信手段に受信されたことを契機とし、前記通信周期を計測し、その計測した通信周期が基準周期を基準とする所定の下限を超えていない場合に、前記データ送信処理を実行した後に、前記データ更新処理時間が前記通信周期に同調して一定となるように前記クロックの周波数の調整を前記クロック制御手段に行わせ、前記データ更新処理を実行することを特徴とする物理量センサ。
The physical quantity sensor according to claim 1,
The data processing means determines whether or not a command from the host has been received by the communication means as the second rounding process, and triggered by the command from the host being received by the communication means, The communication cycle is measured, and when the measured communication cycle does not exceed a predetermined lower limit based on a reference cycle, the data update processing time is synchronized with the communication cycle after executing the data transmission process. The physical quantity sensor is characterized by causing the clock control means to adjust the frequency of the clock so as to be constant and executing the data update process.
請求項6に記載した物理量センサにおいて、
前記データ処理手段は、計測した通信周期が前記所定の下限を超えた場合に、エラー処理を実行し、前記データ更新処理時間が前記通信周期に同調して一定となるように前記クロックの周波数の調整を前記クロック制御手段に行わせ、前記データ更新処理を実行することを特徴とする物理量センサ。
The physical quantity sensor according to claim 6,
The data processing means executes error processing when the measured communication cycle exceeds the predetermined lower limit, and sets the frequency of the clock so that the data update processing time becomes constant in synchronization with the communication cycle. A physical quantity sensor characterized by causing the clock control means to perform adjustment and executing the data update processing.
請求項6又は7に記載した物理量センサにおいて、
前記データ処理手段は、前記ホストからのコマンドが前記通信手段に受信されずに前回のコマンドが前記通信手段に受信されてからの経過時間が前記基準周期を基準とする所定の上限を超えた場合に、エラー処理を実行し、前記データ更新処理時間が前記通信周期に同調して一定となるように前記クロックの周波数の調整を前記クロック制御手段に行わせ、前記データ更新処理を実行することを特徴とする物理量センサ。
The physical quantity sensor according to claim 6 or 7,
The data processing means, when a command from the host is not received by the communication means, and an elapsed time since the previous command was received by the communication means exceeds a predetermined upper limit based on the reference period Performing error processing, causing the clock control means to adjust the frequency of the clock so that the data update processing time becomes constant in synchronization with the communication cycle, and executing the data update processing. Characteristic physical quantity sensor.
JP2013256970A 2013-12-12 2013-12-12 Physical quantity sensor Expired - Fee Related JP6060887B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2013256970A JP6060887B2 (en) 2013-12-12 2013-12-12 Physical quantity sensor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2013256970A JP6060887B2 (en) 2013-12-12 2013-12-12 Physical quantity sensor

Publications (2)

Publication Number Publication Date
JP2015114884A JP2015114884A (en) 2015-06-22
JP6060887B2 true JP6060887B2 (en) 2017-01-18

Family

ID=53528620

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2013256970A Expired - Fee Related JP6060887B2 (en) 2013-12-12 2013-12-12 Physical quantity sensor

Country Status (1)

Country Link
JP (1) JP6060887B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017020406A (en) * 2015-07-10 2017-01-26 日立オートモティブシステムズ株式会社 Control device for internal combustion engine
JP7443677B2 (en) * 2019-05-29 2024-03-06 日本精工株式会社 Bearings with sensors and synchronous measurement systems

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS61189048A (en) * 1985-02-15 1986-08-22 Fujitsu Ltd Communication control overload adjusting system
JPH02280263A (en) * 1989-04-21 1990-11-16 Nec Corp Microprocessor
JP2001157277A (en) * 1999-11-30 2001-06-08 Nissan Motor Co Ltd Multiplex communication unit
JP2002041129A (en) * 2000-07-26 2002-02-08 Fuji Electric Co Ltd Measuring cycle variable type measurement control system
JP2004234622A (en) * 2002-11-19 2004-08-19 Seiko Instruments Inc Living body information measuring system
JP4158193B2 (en) * 2003-03-28 2008-10-01 横河電機株式会社 Multi-point data collection device
JP2010119100A (en) * 2008-10-17 2010-05-27 Panasonic Corp Remote control receiver
JP5760661B2 (en) * 2011-05-09 2015-08-12 セイコーエプソン株式会社 Sensor device and sensor system

Also Published As

Publication number Publication date
JP2015114884A (en) 2015-06-22

Similar Documents

Publication Publication Date Title
JP6487386B2 (en) Server, method, program, recording medium, and system for maintaining time accuracy
US7379480B2 (en) Fast frequency adjustment method for synchronizing network clocks
US9134752B2 (en) Time measurement device, micro-controller and method of measuring time
US10416706B2 (en) Calibration unit for calibrating an oscillator, oscillator arrangement and method for calibrating an oscillator
JP2006244264A (en) Control system
JP6060887B2 (en) Physical quantity sensor
US10411683B2 (en) Information processing device, information processing method, and computer-readable recording medium
KR20180129662A (en) Detection system, sensor and microcomputer
JP4558812B2 (en) Intermittent receiver
JP2011083841A (en) Robot control device, robot control system, and robot control method
EP4167588A1 (en) Adaptation to a pulse width modulation frequency variation for a sensor operating in a synchronous mode
US20210351856A1 (en) Slave equipment, computer readable medium, and embedded system
JP6102785B2 (en) Physical quantity sensor
JP2012124716A (en) Data receiver, data transmitter, control method
JP4839490B2 (en) Automatic data skew correction system
JP2019071554A (en) Electronic control device
JP2011234212A (en) Task control device
US11294421B2 (en) Precision timing between systems
WO2024014243A1 (en) Vehicle-mounted device, program, and information processing method
WO2004072745A1 (en) Control device and control method capable of external synchronization
JP2006031585A (en) Frequency correction method for reference clock
JP2023110410A (en) Communication system, communication method, and program
JP5449484B2 (en) Electronic control device and application execution interval monitoring method applied to electronic control device
JP2005260670A (en) Portable information communication terminal
JP2007307949A (en) Brake vibration damping device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20160128

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20161108

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20161115

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20161128

R151 Written notification of patent or utility model registration

Ref document number: 6060887

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

LAPS Cancellation because of no payment of annual fees