CN109259785A - Counting device and its method of counting for single-chip microcontroller - Google Patents

Counting device and its method of counting for single-chip microcontroller Download PDF

Info

Publication number
CN109259785A
CN109259785A CN201811050935.5A CN201811050935A CN109259785A CN 109259785 A CN109259785 A CN 109259785A CN 201811050935 A CN201811050935 A CN 201811050935A CN 109259785 A CN109259785 A CN 109259785A
Authority
CN
China
Prior art keywords
bit counter
pulse signal
counting
scintillation pulse
counting device
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.)
Pending
Application number
CN201811050935.5A
Other languages
Chinese (zh)
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.)
Huazhong University of Science and Technology
Original Assignee
Huazhong University of Science and Technology
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 Huazhong University of Science and Technology filed Critical Huazhong University of Science and Technology
Priority to CN201811050935.5A priority Critical patent/CN109259785A/en
Publication of CN109259785A publication Critical patent/CN109259785A/en
Pending legal-status Critical Current

Links

Classifications

    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B6/00Apparatus or devices for radiation diagnosis; Apparatus or devices for radiation diagnosis combined with radiation therapy equipment
    • A61B6/02Arrangements for diagnosis sequentially in different planes; Stereoscopic radiation diagnosis
    • A61B6/03Computed tomography [CT]
    • A61B6/037Emission tomography

Landscapes

  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Medical Informatics (AREA)
  • Engineering & Computer Science (AREA)
  • Radiology & Medical Imaging (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Nuclear Medicine, Radiotherapy & Molecular Imaging (AREA)
  • Optics & Photonics (AREA)
  • Pathology (AREA)
  • Physics & Mathematics (AREA)
  • High Energy & Nuclear Physics (AREA)
  • Heart & Thoracic Surgery (AREA)
  • Molecular Biology (AREA)
  • Surgery (AREA)
  • Animal Behavior & Ethology (AREA)
  • General Health & Medical Sciences (AREA)
  • Public Health (AREA)
  • Veterinary Medicine (AREA)
  • Measurement Of Radiation (AREA)

Abstract

This application provides a kind of counting devices and its method of counting for single-chip microcontroller.The counting device includes: multiple selector, is configured as handling to select from externally input scintillation pulse signal the received multiple signals of institute;Trigger controller is configured as the scintillation pulse signal selected according to the multiple selector to control the count mode of multi-bit counter;The multi-bit counter is configured as under the count mode that the trigger controller is controlled carrying out stored counts to the received scintillation pulse signal of institute according to the first predetermined way;And processor, it is configured as handling the enumeration data that the multi-bit counter is recorded the input number to determine the scintillation pulse signal.By counting device and method of counting provided herein, single-chip microcontroller can be reduced and occur to overflow the number interrupted and improve system performance.

Description

Counting device and its method of counting for single-chip microcontroller
Technical field
The present invention relates to signal processing technology fields, more particularly relate to counting device and its counting side of single-chip microcontroller Method.
Background technique
In radioactive medical or medical research field, especially in high energy particle field of detecting and positron emission In the nuclear medicines fields such as tomographic imaging (Positron Emission Tomography, abbreviation PET), radiation is generallyd use Property tracer research human body or the intracorporal pathological tissues of animal or organ metabolic alterations.Radioactive tracer is in human body or animal β+decay occurs in vivo and generates positive electron, positive electron in conjunction with human body or the intracorporal electronics of animal after bury in oblivion and generate a pair The identical but contrary gammaphoton of energy, energy value are 511KeV.Each positive electron and electronics are buried in oblivion referred to as One annihilation event, the gamma light generated by the way that the detectable annihilation event of scintillator detector outside tissue or organ is arranged in Son is simultaneously converted into scintillation pulse signal, can further analyze gammaphoton arrival scintillator by measuring scintillation pulse signal Temporal information, energy information and the location information of detector.By burying in oblivion the technology of meeting, line of response where obtaining annihilation event Position, and radioactive tracer is calculated in human body or the intracorporal distribution water of animal by two dimension or three-dimension disclocation algorithm for reconstructing It is flat, so that the intracorporal physiology of observation biology and biochemical process, this method are related in oncology and some nervous systems in vitro Disease research and diagnoses and treatment on just showing increasingly important role.
In the detection of above-mentioned high energy particle or PET detection, the detection of gammaphoton is completed, is usually visited using scintillator Gammaphoton is transformed into light photon by the scintillation crystal surveyed in device, then with coupling in scintillator detector with scintillation crystal Electrooptical device will be seen that light photon is converted into scintillation pulse signal, adopt eventually by the data connecting with electrooptical device Collector and data processing equipment extract time, energy and location information that scintillation pulse signal is included.
Counting properties are one of the basic property indexs of high energy particle detecting devices or PET detecting devices, are reflected State the limit of equipment collected annihilation event quantity of energy within the unit time.It is above-mentioned in addition to the upper limit for being limited to signal itself The counting properties of existing detecting devices are tended not to more than 1MHz.It short declines in the detection of such as high-radiation flux cosmic ray and partly In the high activity such as phase radioactive tracer, dynamic scan, highly sensitive desired nuclear medicine application, high energy particle will be visited The counting properties limit of measurement equipment is put forward higher requirements.Since gammaphoton is finally get translated into as scintillation pulse signal, because This generallys use the quantity of calculating scintillation pulse signal to realize the calculating of annihilation event.In order to complete the meter of scintillation pulse signal Number generallys use comparator for scintillation pulse signal in the prior art and is converted to square-wave pulse signal, then by square-wave pulse signal Single-chip microcontroller is inputted, is counted by square-wave pulse signal of the single-chip microcontroller to input.
There are two ways to counting in the prior art to above-mentioned scintillation pulse signal: (1) side of external interrupt is used Method records the number of scintillation pulse signal in external interrupt function;(2) compare interruption using timer capture, interrupt letter The number of scintillation pulse signal is recorded in number.
Summary of the invention
During realizing the application, at least there are the following problems in the prior art for inventor's discovery:
A flashing arteries and veins when counting to scintillation pulse signal, is often received using method of counting in the prior art Rush signal, it is necessary to which single-chip microcontroller goes out stacking processing, therefore may result in single-chip microcontroller when receiving the scintillation pulse signal of high frequency Frequently go out stacking, processor (CPU) is needed to be intervened, system clock cycle is occupied, so that sound of the single-chip microcontroller to other programs It answers speed to substantially reduce, can not even operate normally other programs, this affects system performance.
The purpose of the embodiment of the present application is to provide counting device and its method of counting for single-chip microcontroller, to improve systematicness Energy.
To achieve the above object, the counting device and its method of counting provided by the embodiments of the present application for single-chip microcontroller is this What sample was realized:
A kind of counting device for single-chip microcontroller, comprising:
Multiple selector is configured as handling to select from externally input sudden strain of a muscle the received multiple signals of institute Bright pulse signal;
Trigger controller is configured as the scintillation pulse signal selected according to the multiple selector to control The count mode of multi-bit counter;
The multi-bit counter is configured as under the count mode that the trigger controller is controlled pre- according to first Determine mode and carrys out the scintillation pulse signal progress stored counts received to institute;And
Processor is configured as handling the enumeration data that the multi-bit counter is recorded described to determine The input number of scintillation pulse signal.
Preferably, the multiple selector is specifically configured to: matching relationship according to the pre-stored data is identified from outer Portion by its specified input source for inputting the scintillation pulse signal, and by the multiple signals by it is described specify it is defeated The signal behavior for entering source input is from the externally input scintillation pulse signal.
Preferably, first predetermined way includes the mode for counting up or counting downwards.
Preferably, the multi-bit counter be additionally configured to according to the second predetermined way come by the enumeration data export to The processor.
Preferably, second predetermined way includes exporting the mode of the enumeration data or directly with pre-arranged code shape Formula exports the mode of the enumeration data again after encoding to the enumeration data.
Preferably, second predetermined way further includes the mode of predetermined period, and the predetermined period includes the multidigit Period or the multi-bit counter that counter is reset complete the period of stored counts.
Preferably, the multi-bit counter be additionally configured to according to include voltage, electric current or charge electrical form or Magnetic form including magnetic field strength or magnetic flux saves the enumeration data.
Preferably, the counting device further includes filter, is connect with the multiple selector, and be configured as by It is filtered from externally input signal and filtered signal is sent to multiple selector.
Preferably, the counting device further includes frequency divider, with the trigger controller, the multi-bit counter and institute Processor connection is stated, and is configured as dividing the scintillation pulse signal that the trigger controller is sent, it will The multiple received scintillation pulse signal merges, and the scintillation pulse signal after merging is sent to the multidigit Counter.
Preferably, the counting device further includes register, is connect with the multi-bit counter, and is configured as depositing Store up the counting starting point of the multi-bit counter.
A kind of method of counting of above-mentioned counting device, comprising:
Step S1, multiple selector handle to select from externally input flashing arteries and veins the received multiple signals of institute Rush signal;
Step S2, trigger controller control multidigit according to the selected scintillation pulse signal of the multiple selector The count mode of counter;
Step S3, the multi-bit counter is under the count mode that the trigger controller is controlled according to the first predetermined party Formula to carry out stored counts to the scintillation pulse signal;And
Step S4, the enumeration data that the processor records the multi-bit counter are handled described to determine The input number of scintillation pulse signal.
Preferably, the step S1 includes:
Matching relationship according to the pre-stored data inputs the specified of the scintillation pulse signal from outside by it to identify Input source;
It is from externally input described by the signal behavior by the specified input source input in the multiple signals Scintillation pulse signal.
Preferably, the step S2 includes:
The trigger controller is according to amplitude, frequency and/or the phase of the scintillation pulse signal come by the multidigit meter The count mode control of number device is that rising edge driving counts or failing edge driving counts.
Preferably, the step S3 includes:
When the received scintillation pulse signal reach the count upper-limit of the multi-bit counter when, the multidigit counts Device, which occurs to overflow, to interrupt, and record overflows the number interrupted in the storage unit that it is provided with interrupt function logic, and to institute Multi-bit counter is stated to be reset so that it is counted again.
Preferably, the step S4 includes:
The processor calculates the input number of the scintillation pulse signal in the following way:
When the multi-bit counter is interrupted there is no overflowing, the input number=multi-bit counter is current Enumeration data;
When the multi-bit counter, which occurs to overflow, interrupts, input number=multi-bit counter spilling is interrupted The count upper-limit of multi-bit counter described in number *+multi-bit counter current count data.
Preferably, between the step S3 and the step S4, the method also includes:
S31, the multi-bit counter export the enumeration data to the processor according to the second predetermined way.
Preferably, second predetermined way includes exporting the mode of the enumeration data or directly with pre-arranged code shape Formula exports the mode of the enumeration data again after encoding to the enumeration data.
Preferably, second predetermined way further includes the mode of predetermined period, and the predetermined period includes the multidigit Period or the multi-bit counter that counter is reset complete the period of stored counts.
Preferably, the method also includes:
S32, the multidigit are counted according to including voltage, the electrical form of electric current or charge or including magnetic field strength or magnetic The magnetic form of flux saves the enumeration data.
Preferably, before the step S1, the method also includes:
S0, the filter in the counting device are filtered the received multiple signals of institute and by filtered institutes It states multiple signals and is sent to the multiple selector to select from externally input scintillation pulse signal.
Preferably, before the step S3, the method also includes:
Frequency divider in the counting device divides the scintillation pulse signal that the trigger controller is sent And the scintillation pulse signal after frequency dividing is sent to the multi-bit counter,
Correspondingly, the step S4 includes:
Processor calculates the input number of scintillation pulse signal in the following way:
When the multi-bit counter is interrupted there is no overflowing, the input number=multi-bit counter is current The frequency dividing number of frequency divider described in enumeration data *;
When the multi-bit counter, which occurs to overflow, interrupts, the input number=(in the spilling of the multi-bit counter Count upper-limit+multi-bit counter current count data of multi-bit counter described in disconnected number *) frequency divider described in * point Frequency number.
As can be seen from the technical scheme provided by the above embodiments of the present application, the embodiment of the present application is by receiving scintillation pulse Multiple selector, trigger controller, multi-bit counter and the place inside the counting device for being applied to single-chip microcontroller are utilized when signal The devices such as device are managed to be counted, all go out stacking, therefore this when receiving scintillation pulse signal every time without single-chip microcontroller The single-chip microcontroller when interrupting would not be caused frequently to go out stacking, thus sound of the CPU to other programs of single-chip microcontroller can be improved Speed is answered, and then system performance can be improved.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The some embodiments recorded in application, for those of ordinary skill in the art, in the premise of not making the creative labor property Under, it can also be obtained according to these attached drawings other attached drawings.
Fig. 1 is the structural schematic diagram according to provided by the embodiment of the present application for the counting device of single-chip microcontroller;
Fig. 2 is the flow diagram of the method for counting of the counting device according to provided by the embodiment of the present application.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete Site preparation description, it is clear that described embodiment is only used for illustrating a part of the embodiment of the application, rather than all Embodiment, it is undesirable that limitation scope of the present application or claims.Based on the embodiment in the application, this field is common The application guarantor all should belong in technical staff's all other embodiment obtained without making creative work The range of shield.
It should be noted that it can be arranged directly on another when element is referred to as on " setting exists " another element On element or there may also be elements placed in the middle.When element is referred to as " connection/connection " to another element, it be can be directly Another element is connect/be attached in succession or may be simultaneously present centering elements.Term as used herein " connection/connection " can To include electrical and/or mechanical-physical connection/connection.Term as used herein "comprises/comprising" refers to feature, step or element Presence, but the presence or addition of one or more other features, step or element is not precluded.Term as used herein "and/or" includes any and all combinations of one or more related listed items.
Unless otherwise defined, all technical and scientific terms used herein and the technical field for belonging to the application The normally understood meaning of technical staff is identical.Term used herein is intended merely to the purpose of description specific embodiment, and It is not intended to limitation the application.
With reference to the accompanying drawing to provided by the embodiment of the present application be used for single-chip microcontroller counting device and its method of counting into Row is described in detail.
As shown in Figure 1, counting device 10 can be arranged in single-chip microcontroller (for example, STM32), it may include mutually interconnecting Multiple selector 11, trigger controller 12, multi-bit counter 13 and the processor 14 connect.Wherein, multiple selector 11 can be with For being handled the received multiple signals of institute to select from externally input scintillation pulse signal, and by it is selected go out Scintillation pulse signal is sent to trigger controller 12;Trigger controller 12 can be used for the sudden strain of a muscle according to transmitted by multiple selector 11 Bright pulse signal controls the count mode of multi-bit counter 13;Multi-bit counter 13 can be used for being controlled in trigger controller 12 Stored counts is carried out to the received scintillation pulse signal of institute according to the first predetermined way under the count mode of system;And processor 14 can be used for handling the enumeration data that multi-bit counter 13 records the input number to determine scintillation pulse signal.
In embodiments herein, multiple selector 11 can have multiple input terminals, can be by the multiple Input terminal receives signal.It, can be with matching relationship according to the pre-stored data (for example, input source after receiving multiple signals Mark or port numbering) come identify from outside by its input scintillation pulse signal specified input source (for example, single-chip microcontroller External trigger pin), and then by received multiple signals be from outer by specifying the signal behavior of input source input The scintillation pulse signal of portion's input, is then sent to trigger controller 12 for selected scintillation pulse signal.The multichannel letter It number may include the scintillation pulse signal by specifying input source input, also may include the letter that other devices are sent in single-chip microcontroller Number.The scintillation pulse signal may come from external scintillation crystal and the photoelectricity such as photomultiplier tube or silicon photoelectric multiplier and turn The scintillation detector of parallel operation part composition or the gas radiation detector of the devices such as Geiger counter tube or proportional counter tube composition.
After the scintillation pulse signal for receiving the transmission of multiple selector 11, trigger controller 12 can be according to flashing arteries and veins The characteristics such as the amplitude, frequency and/or phase of signal are rushed to control the count mode of multi-bit counter 13.For example, working as scintillation pulse When the amplitude of signal is changed very greatly, trigger controller 12 can be controlled the count mode of multi-bit counter 13 as rising edge driving It counts or failing edge driving counts.
Multi-bit counter 13 can be 2 or more counters, such as 4 digit counters, 8 digit counters, 16 digit counters Or 32 digit counter etc..After the scintillation pulse signal for receiving multiple selector 11 or the transmission of trigger controller 12, multidigit Counter 13 can under the control of trigger controller 12 according to the first predetermined manner come to the received scintillation pulse signal of institute into Row stored counts, and export the enumeration data recorded to processor 14 according to the second predetermined way.In the received sudden strain of a muscle of institute When bright pulse signal reaches the count upper-limit of multi-bit counter 13, multi-bit counter 13, which may occur to overflow, is interrupted, and is set at it It is equipped with record in the storage unit of interrupt function logic and overflows the number interrupted.At this point, multi-bit counter can after a reset again It is secondary to be counted.Multi-bit counter 13 can also save enumeration data while being counted.
Receive multi-bit counter 13 output enumeration data after, processor 14 can be to the enumeration data at Reason.Processor 14 can calculate the input number of scintillation pulse signal in the following way:
When multi-bit counter 13 is interrupted there is no overflowing, the current count number of number=multi-bit counter 13 is inputted According to;
When multi-bit counter 13, which occurs to overflow, interrupts, the spilling interruption times * for inputting number=multi-bit counter 13 is more The current count data of count upper-limit+multi-bit counter 13 of digit counter 13.
According to the calculated result of processor 14, the input number of scintillation pulse signal can be learnt.
In another embodiment of the application, counting device 10 can also include filter, and the filter and multichannel are selected The connection of device 11 is selected, is used to be filtered from externally input signal and filtered signal is sent to multi-path choice Device 11, in order to which multiple selector 11 selects scintillation pulse signal.
In another embodiment of the application, counting device 10 can also include frequency divider, with trigger controller 12, more Digit counter 13 and processor 14 connect, and are used to divide the scintillation pulse signal that trigger controller 12 is sent, will Multiple received scintillation pulse signal merges, and the scintillation pulse signal after merging is sent to multi-bit counter 13, this Sample can reduce the number that multi-bit counter 13 is counted, and also reduce the number that multi-bit counter 13 is interrupted.Accordingly Ground, processor 14 can be handled according to the enumeration data of the frequency dividing number of frequency divider and multi-bit counter to determine The quantity of the scintillation pulse signal inputted.
Processor 14 can calculate the input number of scintillation pulse signal in the following way:
When multi-bit counter 13 is interrupted there is no overflowing, the current count number of number=multi-bit counter 13 is inputted According to the frequency dividing number of * frequency divider;
When multi-bit counter 13, which occurs to overflow, interrupts, input number=(the spilling interruption times * of multi-bit counter 13 is more The current count data of count upper-limit+multi-bit counter 13 of digit counter 13) * frequency divider frequency dividing number.
In another embodiment of the application, counting device 10 can also include register, and register can be used for storing The starting point of timing and the start point data recorded can be sent to multi-bit counter 13 after counting end cycle, in order to Multi-bit counter 13 is counted according to the start point data that it sends.The start point data may be used as multi-bit counter 13 Original state.
By above-mentioned counting device provided by the present application, when receiving scintillation pulse signal, directly pass through the more of inside The devices such as road selector 11, trigger controller 12, multi-bit counter 13 and processor 14 are counted, without outside The number that scintillation pulse signal is recorded in portion's interrupt function logic does not need single-chip microcontroller yet and is receiving scintillation pulse signal every time When all go out stacking, therefore this would not cause occur to overflow interrupt when single-chip microcontroller frequently go out stacking, thus monolithic can be improved System performance can be improved to the response speeds of other programs in the CPU of machine.In addition, the counting device of the application uses Multi-bit counter, count upper-limit can be improved in this, can also reduce and occur to overflow the number interrupted, and then can reduce system function Consumption, it is also possible that the CPU of single-chip microcontroller can execute other programs in time, and then can be further improved system performance.
Present invention also provides the methods counted using above-mentioned counting device, as shown in Figure 2.This method includes following Step:
S1: multiple selector handles to select from externally input scintillation pulse and believe the received multiple signals of institute Number.
After receiving multiple signals, multiple selector can be with matching relationship according to the pre-stored data (for example, input source Mark or port numbering) it identifies from the external specified input source for receiving scintillation pulse signal (for example, the external touching of single-chip microcontroller Carry out the coffin upon burial foot), so by received multiple signals be from externally input by specifying the signal behavior of input source input Then selected scintillation pulse signal is sent to trigger controller by scintillation pulse signal.
S2: trigger controller controls the counting of multi-bit counter according to the selected scintillation pulse signal of multiple selector Mode.
It is receiving after the scintillation pulse signal that multiple selector is sent, trigger controller can be according to scintillation pulse The characteristics such as amplitude, frequency and/or the phase of signal control the count mode of multi-bit counter.The count mode includes rising It is counted along driving or failing edge driving counts.The rising edge driving, which counts, can refer to only when the rising edge of scintillation pulse signal Just counted when arrival, failing edge driving count can refer to only when the failing edge of scintillation pulse signal arrives just into Row counts.
S3: multi-bit counter is under the count mode that trigger controller is controlled according to the first predetermined way come to being received Scintillation pulse signal carry out stored counts.
After receiving the scintillation pulse signal that multiple selector or trigger controller are sent, multi-bit counter can be Under the count mode that trigger controller is controlled according to the first predetermined manner come to received scintillation pulse signal rising edge Number or failing edge number carry out stored counts.Received scintillation pulse signal reach the count upper-limit of multi-bit counter When, multi-bit counter, which may occur to overflow, interrupts, in the storage unit that it is provided with interrupt function logic in record spilling Disconnected number.At this point, multi-bit counter can be counted again after a reset.
First predetermined way may include the modes such as counting up or counting downwards.For example, when multi-bit counter connects It, can be by carrying out addition to the enumeration data recorded before when receiving the rising edge or failing edge of a scintillation pulse signal Operation, subtraction or series calculate etc. to carry out stored counts.For example, by the enumeration data recorded before add deduct 1,2 or Other fixed numbers, or increase or successively decrease one by one with binary system or the decimal system.
The stored counts can refer to be continued to count on the basis of the enumeration data recorded before.Before described The enumeration data of record can refer to multi-bit counter from original state to resetting the enumeration data recorded during this for the first time, May also mean that multi-bit counter after I time resetting in the preceding enumeration data recorded during this of I+1 time resetting, In, I is positive integer.If multi-bit counter does not receive any scintillation pulse signal, the enumeration data recorded before It can refer to the original state of multi-bit counter.The original state of multi-bit counter can indicate with default value, for example, 0, 1 or other numerical value (for example, 2n- 1, n are the digit of counter).
Institute is received before the enumeration data can be reset with original state of the multi-bit counter since most to first time The number of scintillation pulse signal is corresponding, after can also reset each time with multi-bit counter received scintillation pulse signal it is a Number corresponds to.It should be noted that multi-bit counter returns to its original state after being reset.
S4: the enumeration data that processor records multi-bit counter is handled to determine the defeated of scintillation pulse signal Indegree.
After the enumeration data for receiving multi-bit counter transmission, processor can be handled the enumeration data. Processor can calculate the input number of scintillation pulse signal in the following way:
When multi-bit counter is interrupted there is no overflowing, number=multi-bit counter current count data are inputted;
When multi-bit counter, which occurs to overflow, interrupts, number=multi-bit counter spilling interruption times * multidigit meter is inputted Count upper-limit+multi-bit counter current count data of number device.
According to the calculated result of processor, the input number of scintillation pulse signal can be learnt.
In another embodiment of the application, between step S3 and step S4, this method can also include:
S31, multi-bit counter export enumeration data to processor according to the second predetermined way.
After the rising edge number or failing edge number of multi-bit counter record scintillation pulse signal, multi-bit counter can With according to the second predetermined way come by the counting of the rising edge number or failing edge number about scintillation pulse signal recorded Data are exported to processor.
Second predetermined way may include the mode directly exported or in the form of pre-arranged code to the counting The mode exported again after data encoding, second predetermined way also can also include the mode of predetermined period.For example, multidigit meter Number devices can direct output count data, can also be with coding forms pair such as binary code, binary coded decimal (BCD) code, cyclic codes Output count data again after enumeration data is encoded, consequently facilitating follow-up data is handled.The predetermined period may include more Period or multi-bit counter that digit counter is reset complete the period of stored counts.For example, multi-bit counter can be each Be reset rear output count data, can also after the stored counts for completing all data output count data again, in order to full The different application demand of foot.It should be noted that exporting meter in the way of exporting again in the way of directly exporting or after coding When number data, output data can also be carried out in the way of predetermined period.
In another embodiment of the application, this method can also include:
S32: multi-bit counter saves recorded enumeration data according to predetermined form.
Multi-bit counter can be saved according to predetermined form while counting to scintillation pulse signal or later The enumeration data recorded.The predetermined form may include the electrical form such as voltage, electric current or charge, also may include magnetic field The magnetism form such as intensity or magnetic flux.
In another embodiment of the application, before step S1, this method can also include:
S0: the filter in counting device is filtered the multiplex pulse signal inputted and will be filtered more Road pulse signal is sent to multiple selector to select from externally input scintillation pulse signal.
In another embodiment of the application, before step S3, this method can also include:
S21: the frequency divider in counting device carries out frequency dividing to the scintillation pulse signal that trigger controller is sent and will frequency dividing Scintillation pulse signal afterwards is sent to multi-bit counter.
The scintillation pulse signal that frequency divider can send trigger controller divides, will multiple received flashing arteries and veins It rushes signal to merge, and the scintillation pulse signal after merging is sent to multi-bit counter.In this way, multidigit counting can be reduced The number that device is counted also reduces the number that multi-bit counter is interrupted.
Correspondingly, step S4 may include: that processor exports multi-bit counter according to the frequency dividing number of frequency divider Enumeration data handled with determine input scintillation pulse signal number.
Processor can calculate the input number of scintillation pulse signal in the following way:
When multi-bit counter is interrupted there is no overflowing, number=multi-bit counter current count data * points of input The frequency dividing number of frequency device;
When multi-bit counter, which occurs to overflow, interrupts, number=(spilling interruption times * multidigit meter of multi-bit counter is inputted Number devices count upper-limit+multi-bit counter current count data) * frequency divider frequency dividing number.
By above-mentioned method of counting provided by the present application, when receiving scintillation pulse signal, directly pass through the more of inside The devices such as road selector, trigger controller, multi-bit counter and processor are tired to carry out to the received scintillation pulse signal of institute Product counts, and the number without recording scintillation pulse signal in external interrupt function logic, this would not cause occurring Single-chip microcontroller frequently goes out stacking when interruption, thus response speed of the CPU to other programs of single-chip microcontroller can be improved, and then can mention High system performance.In addition, count upper-limit can be improved in this, can also drop present invention take advantage of that multi-bit counter is counted It is low to occur to overflow the number interrupted, and then system power dissipation can be reduced, it is also possible that the CPU of single-chip microcontroller can execute it in time Its program, and then can be further improved system performance, upper limiting frequency can also be improved, such as upper limiting frequency can achieve 30MHz is far longer than upper limiting frequency 300KHz~400KHz in the prior art.
Device, unit or other devices that above-described embodiment illustrates etc., specifically can be by computer chip, semiconductor chip And/or entity is realized, or is realized by the product with certain function.For convenience of description, describe apparatus above when with Function is divided into various units and describes respectively.It certainly, when implementing the application can be the function of each unit same or multiple It is realized in semiconductor chip.
Although this application provides the method operating procedure as described in above-described embodiment or flow chart, based on conventional or It in the method may include more or less operating procedure without creative labor.There is no must in logicality In the step of wanting causality, the execution of these steps sequence is not limited to provided by the embodiments of the present application execute sequence.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment Dividing may refer to each other, and the highlights of each of the examples are differences from other embodiments.
Above-described embodiment be for convenient for those skilled in the art it will be appreciated that and being described using the application 's.Person skilled in the art obviously easily can make various modifications to these embodiments, and described herein General Principle is applied in other embodiments without having to go through creative labor.Therefore, the application is not limited to the above embodiments, Those skilled in the art do not depart from improvement that the application scope is made and modification all should be in this Shens according to the announcement of the application Within protection scope please.

Claims (21)

1. a kind of counting device for single-chip microcontroller, which is characterized in that the counting device includes:
Multiple selector is configured as handling to select from externally input flashing arteries and veins the received multiple signals of institute Rush signal;
Trigger controller is configured as the scintillation pulse signal selected according to the multiple selector to control multidigit The count mode of counter;
The multi-bit counter is configured as under the count mode that the trigger controller is controlled according to the first predetermined party Formula carrys out the scintillation pulse signal received to institute and carries out stored counts;And
Processor is configured as handling to determine the flashing enumeration data that the multi-bit counter is recorded The input number of pulse signal.
2. counting device according to claim 1, which is characterized in that the multiple selector is specifically configured to: according to Pre-stored matching relationship inputs the specified input source of the scintillation pulse signal to identify from outside by it, and will The signal behavior by the specified input source input in the multiple signals is to believe from the externally input scintillation pulse Number.
3. counting device according to claim 1, which is characterized in that first predetermined way include count up or to The mode of lower counting.
4. counting device according to claim 1, which is characterized in that the multi-bit counter is additionally configured to according to second Predetermined way exports the enumeration data to the processor.
5. counting device according to claim 4, which is characterized in that second predetermined way includes described in directly output The mode of enumeration data or by pre-arranged code form to the enumeration data coding after export the enumeration data again in a manner of.
6. counting device according to claim 4, which is characterized in that second predetermined way further includes predetermined period Mode, the predetermined period include that the period that the multi-bit counter is reset or the multi-bit counter complete stored counts Period.
7. counting device according to claim 1, which is characterized in that the multi-bit counter is additionally configured to according to including Voltage, the electrical form of electric current or charge or magnetic form including magnetic field strength or magnetic flux save the count number According to.
8. counting device according to claim 1, which is characterized in that the counting device further includes filter, with institute Multiple selector connection is stated, and is configured as to be filtered from externally input signal and sending out filtered signal Give multiple selector.
9. counting device according to claim 1, which is characterized in that the counting device further includes frequency divider, with institute State trigger controller, the multi-bit counter is connected with the processor, and be configured as to the trigger controller send The scintillation pulse signal divided, the multiple received scintillation pulse signal is merged, and after merging The scintillation pulse signal be sent to the multi-bit counter.
10. counting device according to claim 1, which is characterized in that the counting device further includes register, with institute Multi-bit counter connection is stated, and is configured as storing the counting starting point of the multi-bit counter.
11. a kind of method of counting of counting device according to claim 1, which is characterized in that the method for counting includes:
Step S1, multiple selector handle to select from externally input scintillation pulse and believe the received multiple signals of institute Number;
Step S2, trigger controller control multidigit counting according to the selected scintillation pulse signal of the multiple selector The count mode of device;
Step S3, the multi-bit counter are come under the count mode that the trigger controller is controlled according to the first predetermined way Stored counts is carried out to the scintillation pulse signal;And
Step S4, the enumeration data that the processor records the multi-bit counter are handled to determine the flashing The input number of pulse signal.
12. method of counting according to claim 11, which is characterized in that the step S1 includes:
Matching relationship according to the pre-stored data inputs the specified input of the scintillation pulse signal to identify from outside by it Source;
It is from the externally input flashing by the signal behavior by the specified input source input in the multiple signals Pulse signal.
13. method of counting according to claim 11, which is characterized in that the step S2 includes:
The trigger controller is according to amplitude, frequency and/or the phase of the scintillation pulse signal come by the multi-bit counter Count mode control be rising edge driving count or failing edge driving count.
14. method of counting according to claim 11, which is characterized in that the step S3 includes:
When the received scintillation pulse signal reach the count upper-limit of the multi-bit counter when, multi-bit counter hair Raw overflow is interrupted, and record overflows the number interrupted in the storage unit that it is provided with interrupt function logic, and to described more Digit counter is reset so that it is counted again.
15. method of counting according to claim 11, which is characterized in that the step S4 includes:
The processor calculates the input number of the scintillation pulse signal in the following way:
When the multi-bit counter is interrupted there is no overflowing, input number=multi-bit counter current count Data;
When the multi-bit counter, which occurs to overflow, interrupts, input number=multi-bit counter spilling is interrupted secondary Count upper-limit+multi-bit counter current count data of multi-bit counter described in number *.
16. method of counting according to claim 11, which is characterized in that between the step S3 and the step S4, The method also includes:
S31, the multi-bit counter export the enumeration data to the processor according to the second predetermined way.
17. method of counting according to claim 16, which is characterized in that second predetermined way includes directly exporting institute State the mode of enumeration data or in the form of pre-arranged code to the side for exporting the enumeration data after enumeration data coding again Formula.
18. method of counting according to claim 16, which is characterized in that second predetermined way further includes predetermined period Mode, the predetermined period includes that the period that the multi-bit counter is reset or the multi-bit counter complete stored counts Period.
19. method of counting according to claim 11, which is characterized in that the method also includes:
S32, the multidigit are counted according to including voltage, the electrical form of electric current or charge or including magnetic field strength or magnetic flux Magnetic form save the enumeration data.
20. method of counting according to claim 11, which is characterized in that before the step S1, the method is also wrapped It includes:
S0, the filter in the counting device are filtered the received multiple signals of institute and will be filtered described more Road signal is sent to the multiple selector to select from externally input scintillation pulse signal.
21. method of counting according to claim 11, which is characterized in that before the step S3, the method is also wrapped It includes:
S21, the frequency divider in the counting device divide the scintillation pulse signal that the trigger controller is sent And the scintillation pulse signal after frequency dividing is sent to the multi-bit counter,
Correspondingly, the step S4 includes:
Processor calculates the input number of scintillation pulse signal in the following way:
When the multi-bit counter is interrupted there is no overflowing, input number=multi-bit counter current count The frequency dividing number of frequency divider described in data *;
When the multi-bit counter, which occurs to overflow, interrupts, the input number=(the spilling interruption time of the multi-bit counter Count upper-limit+multi-bit counter current count data of multi-bit counter described in number *) frequency divider described in * frequency dividing Number.
CN201811050935.5A 2018-09-10 2018-09-10 Counting device and its method of counting for single-chip microcontroller Pending CN109259785A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811050935.5A CN109259785A (en) 2018-09-10 2018-09-10 Counting device and its method of counting for single-chip microcontroller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811050935.5A CN109259785A (en) 2018-09-10 2018-09-10 Counting device and its method of counting for single-chip microcontroller

Publications (1)

Publication Number Publication Date
CN109259785A true CN109259785A (en) 2019-01-25

Family

ID=65187721

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811050935.5A Pending CN109259785A (en) 2018-09-10 2018-09-10 Counting device and its method of counting for single-chip microcontroller

Country Status (1)

Country Link
CN (1) CN109259785A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115311780A (en) * 2022-08-15 2022-11-08 广东便捷神科技股份有限公司 Replenishment system of automatic beverage vending machine and replenishment method thereof

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0884727A (en) * 1994-09-16 1996-04-02 Hitachi Medical Corp Image processor for medical image diagnostic apparatus
CN102520432A (en) * 2011-10-12 2012-06-27 四川中测辐射科技有限公司 Multi-channel CT dosimeter
CN205809317U (en) * 2016-06-20 2016-12-14 中国船舶重工集团公司第七一八研究所 A kind of nuclear pollution detection device
CN206149241U (en) * 2016-11-08 2017-05-03 华大半导体有限公司 Pulse count device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0884727A (en) * 1994-09-16 1996-04-02 Hitachi Medical Corp Image processor for medical image diagnostic apparatus
CN102520432A (en) * 2011-10-12 2012-06-27 四川中测辐射科技有限公司 Multi-channel CT dosimeter
CN205809317U (en) * 2016-06-20 2016-12-14 中国船舶重工集团公司第七一八研究所 A kind of nuclear pollution detection device
CN206149241U (en) * 2016-11-08 2017-05-03 华大半导体有限公司 Pulse count device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
武星河: "基于光电倍增管的光子计数系统的设计", 《中国优秀硕士学位论文全文数据库信息科技辑》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115311780A (en) * 2022-08-15 2022-11-08 广东便捷神科技股份有限公司 Replenishment system of automatic beverage vending machine and replenishment method thereof

Similar Documents

Publication Publication Date Title
US11156732B2 (en) System and method for image reconstruction in positron emission tomography
CN102608648B (en) Time of flight measurements in positron emission tomography
JP2001524217A (en) Method and apparatus for preventing signal pile-up
CN104688261B (en) Totally digitilized SiPM PET datas acquisition system based on FPGA and ADC
CN109765599A (en) Detector, rack and PET device based on silicon photomultiplier
CN102955167A (en) Apparatus and method for discriminating energy bands of photons in multi-band radiation
CN108871596A (en) Imaging device and imaging system including the imaging device
CN109259785A (en) Counting device and its method of counting for single-chip microcontroller
US7409077B2 (en) Nearest-neighbor rebinning in clinical PET using on-line three dimensional LOR-to-bin mapping
WO2024140346A1 (en) Method and apparatus for processing scintillation pulses, and device and storage medium
CN103890609A (en) Method for estimating number of random coincidences and device for estimating number of random coincidences
CN102028484B (en) Detector module for an emission tomography scanner
CN113057667A (en) PET detector signal sampling method, device, electronic device and storage medium
CN203069792U (en) Automatic trigger exposure circuit of flat panel detector
CN108181331A (en) A kind of signal detection circuit and detector
CN108665972B (en) PET (positron emission tomography) electronics data processing method and PET electronics system
CN104598356A (en) Event ordering method and device
WO2004109332A1 (en) Generating detector efficiency estimates for a oet scanner
CN113100796A (en) PET system correction method, apparatus, electronic apparatus, and storage medium
CN208887794U (en) Imaging device and imaging system including the imaging device
US20180196144A1 (en) Nuclear medicine diagnostic apparatus and calibration method
CN110584693B (en) Dual-mode imaging method, device and system
CN114325796A (en) DOI automatic calibration method and device for double-end PET detector
CN102283663B (en) Primitive event detection module for all-digital processing unit
CN202211698U (en) Original event detection module for full-digitization processing device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination