CN109814441A - A kind of method that STM32 microcontroller receives absolute encoder data - Google Patents
A kind of method that STM32 microcontroller receives absolute encoder data Download PDFInfo
- Publication number
- CN109814441A CN109814441A CN201811646009.4A CN201811646009A CN109814441A CN 109814441 A CN109814441 A CN 109814441A CN 201811646009 A CN201811646009 A CN 201811646009A CN 109814441 A CN109814441 A CN 109814441A
- Authority
- CN
- China
- Prior art keywords
- data
- encoder
- absolute encoder
- microcontroller
- pulse
- 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
Links
Landscapes
- Transmission And Conversion Of Sensor Element Output (AREA)
- Arrangements For Transmission Of Measured Signals (AREA)
Abstract
The invention discloses a kind of methods that STM32 microprocessor receives absolute encoder data, the data that the absolute encoder is acquired using the output of SSI interface, 422 chips including two with data transmit-receive function, the date delivery outlet of absolute value encoder is connected by the data input port of 422 chips and single-chip microcontroller, the pulse delivery outlet of single-chip microcontroller is connected by the clock interface of 422 chips and absolute encoder, microprocessor is sent in absolute encoder by pulse delivery outlet output pulse signal through 422 chips, absolute encoder sends the data of encoder in the rising edge of pulse, the data that the single-chip microcontroller is sent according to the pulse signal of output in the rising edge acquisition encoder of signal.The present invention has the advantages that can control data transmission by the pulse signal of 422 chips cooperation output on hardware and read, the data of the convenient absolute encoder in stm32 microcomputer reads with ssi interface, realize it is simple, at low cost, can be convenient realize data receiving reading.
Description
Technical field
The present invention relates to data to transmit reading field, in particular to a kind of STM32 receives the absolute coding with SSI interface
The method of device data.
Background technique
Encoder is a kind of device for angular displacement or straight-line displacement being converted into electric signal, is divided into absolute value type and increment
Type.The price of absolute value encoder is about 4 times of incremental encoder or more at present, and 70% application is phase on domestic market
To economic incremental encoder.And in the heavy industry industry such as high-accuracy mechanical equipment or steel, harbour and lifting, due to right
The required precision of measurement is relatively high, and more situations will use absolute value encoder.In these heavy industry industrial applications, due to
Operating condition is more severe, so the index requests such as shock resistance and vibration to encoder are higher.
Absolute encoder is determined the uniqueness of each position by mechanical location, it is without memory, without reference to point, and not
With counting always, the noiseproof feature of so encoder, the reliability of data are substantially increased.It is obvious excellent in terms of positioning
In incremental encoder, absolute type encoder is because of its high-precision, and output digit is more, and parallel output is no longer appropriate for, and is generally selected
It is exported with Serial output or bus-type.As a kind of realization, communications protocol has been widely used SSI communications protocol earlier,
The company of many foreign countries is all proposed with SSI communication interface absolute value encoder.Emerging bus-type absolute value encoder
Although having the advantages that connection is easy, versatile, it is expensive, and hardware and software exploitation is complicated, and therefore, it is difficult to complete
Full substitution SSI communication modes.
SSI (synchronous serial interface) be it is a kind of by Max Stegman GmbH (be now the standard interface of sick) exploitation,
The advantage of the transmission mode is that time and the data transmission bauds of record position can be controlled by PLC, it is ensured that safe transmission
Data.SSI interface is made of four cores (clock+, clock-, data+, data-) synchronization signal, is believed using Double-strand transmission SSI
Number, strong antijamming capability, physical layer is based on RS-422 or RS-485, clock signal and data-signal and is transmitted using differential mode
(effectively reducing electromagnetic interference).
Navigational route type industrial truck needs angular displacement and straight-line displacement to motor to measure, to reach to the accurate of motor
Control.And navigational route type industrial truck generally uses 32 8-digit microcontrollers of STM32 Cortex-3, it is therefore desirable to realize
The data receiver of the absolute encoder of the upper SSI interface of STM32, the application just realize a kind of data acquisition and transmission method.
Summary of the invention
It is an object of the invention to overcome the deficiencies of the prior art and provide a kind of STM32 microcontrollers to receive absolute coding
The method of device data is transmitted for realizing using the data between STM32 controller and the absolute encoder with ssi interface,
Obtain the data in absolute encoder.
To achieve the goals above, a kind of the technical solution adopted by the present invention are as follows: STM32 microcontroller reception absolute coding
The method of device data, the absolute encoder export the data of acquisition using SSI interface, including two have the function of data transmit-receive
422 chips, the date delivery outlet of absolute value encoder connects by the data input port of 422 chips and single-chip microcontroller, single-chip microcontroller
Pulse delivery outlet connected by the clock interface of 422 chips and absolute encoder, microcontroller is exported by pulse delivery outlet
Pulse signal is sent in absolute encoder through 422 chips, and absolute encoder sends the data of encoder in the rising edge of pulse,
The data that the single-chip microcontroller is sent according to the pulse signal of output in the rising edge acquisition encoder of signal.
The data that microcontroller receives are binary gray code, by binary gray code data conversion at natural two into
System.
Microcontroller, which exports CLK pulse, to be exported by Timer Controlling I/O pin.
Microcontroller is used as frame end mark without variation using in one of high level holding of time, and clock is inputted work
For monostable input, the data output state of absolute encoder is controlled by monostable output, when microcontroller output is a fixed length
When the high level of degree, the output data of absolute encoder terminates.
Clock pulses is that interruption is generated by timer count, and control GPIO pin exports the 124kHz of 26 duty ratios 50%
Pulse, then maintain the high level of 52 pulse lengths, repeatedly this period;When exporting first pulses low, if
Setting controlling of sampling variable is low level, is sampled when from second pulses low, until the 26th pulses low, sampling knot
Beam, controlling of sampling variable revert to high level;GPIO rising edge is set and interrupts service function, is low level in controlling of sampling variable
When, to data sampling, acquire 25 data, high position data is preceding, and low data is in rear, composition data.
It is passed the present invention has the advantages that can control data by the pulse signal of 422 chips cooperation output on hardware
It is defeated and read, it is convenient that the data with the absolute encoder of ssi interface are read in stm32 microcontroller, realize simple, cost
It is low, it can be convenient the receiving reading for realizing data.
Detailed description of the invention
Below to each width attached drawing of description of the invention expression content and figure in label be briefly described:
Hardware configuration schematic diagram of the Fig. 1 between stm32 of the present invention and the absolute encoder with ssi interface;
Fig. 2 is the schematic diagram that binary gray code of the present invention is converted to natural binary.
Specific embodiment
A specific embodiment of the invention is made further detailed below against attached drawing by the description to optimum embodiment
Thin explanation.
As shown in Figure 1, scheme is realized on stm32F207ZGT6 board, software development is in keil5 the integration environment
Under, DDK uses keil.stm32f2xx_DFP.1.0.7.pdsc.Hardware aspect is 422 cores simultaneous with transmission-receiving function
Piece SN75176A, circuit are simple.Absolute value encoder is Sick AHM36A-S3PC013x12, and total resolution is 25, by
In the only compact size of 36mm and special rotatable plug/cable outlet, which becomes those installation spaces
The choosing of the ideal of limited applications.
Ssi uses the mode of synchronous communication, and the baud rate communicated in this way may be implemented adaptively, needing high speed control in real time
The occasion of system uses high-speed synchronous clock, improves the transmission speed of data, and is not very to data transportation requirements in other
High occasion can increase conveying length using the baud rate of low speed, and ssi communication is divided into main side and from side, main side is
Stm32 controller is absolute value encoder from side.Main side sends synchronous clock pulse, from side after receiving lock-out pulse
Data are sent out in the rising edge of clock.The direction of data and clock transfer is all unidirectional.
Data transmission uses the method for synchronization, and when data transmission does not occur for idle phase, clock and data keep high
Current potential is loaded into the failing edge offence encoder of first pulse and sends data, and then the rising edge of each clock pulses is compiled
Code device sends out data, data it is high-order preceding, for low level rear, clock returns to high level after transmit all digits, several
High level is returned to according to also correspondence.Have several parameter definitions as follows in figure: T is the pulse frequency of clock, and Tp is data transfer interval.
Tm is the monostable departure time, and N is transmission digit.The digit of transmission can be arbitrary, but single-ring encoder is adopted in actual use
With 13, multi-turn uses 25.For being the clock pulses number that can not be known main side in advance and send for square encoder.
It can not thus determine the start bit and stop position of frame.Solution to the problem is that do not have in the time for keep one using high level
Variation is used as frame end mark.Tm monostable time just refers to this time, can be made in practical applications using clock is inputted
For monostable input, by the data output state of monostable output control ssi, once monostable set, the output state of SSI will
Original state is returned to, the cyclic process for starting next data output is prepared.In order to increase reliability, part PLC (such as Siemens
PLC a check bit V) is also added, the output of check bit requires to be low level, by checking whether check bit is 0
Determine whether to be broken or the failure of encoder.Encoder in this way for 25 only needs to provide 26 pulses
Rising edge.
By taking AMH36 series has the encoder of ssi interface as an example, clock pulses range that such absolute encoder is suitable for
For 60kHz -2MHz, the general clock for selecting 125kHz or so.The clock pulses that STM32 microcontroller issues is by timer
It counts and generates interruption, control GPIO pin exports the pulse of the 124kHz of 26 duty ratios 50%, then maintains 52 pulses long
The high level of degree, repeatedly this period.When exporting first pulses low, setting controlling of sampling variable is low level, from
It is sampled when second pulses low, until the 26th pulses low, sampling terminates, and controlling of sampling variable reverts to high electricity
It is flat.GPIO rising edge is set and interrupts service function, when controlling of sampling variable is low level, to data sampling, acquires 25 digits
According to, high position data preceding, for low data in rear, composition data, this data is exactly 25 accurate positions that absolute value encoder is sent
Set data.
Collected SSI data are binary gray codes.Collected binary gray code is converted to natural binary
Code, as shown in Fig. 2, its rule be retain the highest order of the highest order binary code the most of Gray code, and secondary high-order natural two into
Code processed be high-order natural binary code or secondary high-order Gray code it is different or, and natural binary code remaining everybody and it is time high-order from
Right binary code asks method similar.Binary code is linear relationship with bracing wire position, and binary code and bracing wire position is corresponding
Get up, so exact position that bracing wire can be determined according to obtained binary code is calculated according to the binary code of two o'clock
The distance of two o'clock out, and then reach the accurate control to equipment.SSI interface absolute encoder data are being realized just on stm32
Really receive, it is correct to parse, motor is precisely controlled with reaching.This method is also applied for the device data of other SSI interfaces
It receives.It is equally applicable that this SSI collecting method in other dominant frequency reaches necessarily required microcontroller chip.
Obviously present invention specific implementation is not subject to the restrictions described above, as long as using method concept and skill of the invention
The improvement for the various unsubstantialities that art scheme carries out, it is within the scope of the present invention.
Claims (5)
1. a kind of method that STM32 microcontroller receives absolute encoder data, the absolute encoder is exported using SSI interface
The data of acquisition, it is characterised in that: including two 422 chips with data transmit-receive function, the date of absolute value encoder is defeated
Outlet is connected by the data input port of 422 chips and single-chip microcontroller, and the pulse delivery outlet of single-chip microcontroller is compiled by 422 chips and absolutely
The clock interface connection of code device, microcontroller are sent to absolute coding through 422 chips by pulse delivery outlet output pulse signal
In device, absolute encoder sends the data of encoder in the rising edge of pulse, and the single-chip microcontroller exists according to the pulse signal of output
The data that the rising edge acquisition encoder of signal is sent.
2. the method that a kind of STM32 microcontroller as described in claim 1 receives absolute encoder data, it is characterised in that:
The data that microcontroller receives are binary gray code, by binary gray code data conversion at natural binary.
3. the method that a kind of STM32 microcontroller as claimed in claim 1 or 2 receives absolute encoder data, feature exist
In: microcontroller, which exports CLK pulse, to be exported by Timer Controlling I/O pin.
4. the method that a kind of STM32 microcontroller a method according to any one of claims 1-3 receives absolute encoder data, feature
Be: microcontroller is kept in one of time without variation using high level as frame end mark, using clock input as
Monostable input, by the data output state of monostable output control absolute encoder, when microcontroller output is certain length
High level when, the output data of absolute encoder terminates.
5. the method that a kind of STM32 microcontroller as described in claim 1-4 is any receives absolute encoder data, feature
Be: clock pulses is that interruption is generated by timer count, and control GPIO pin exports the 124kHz's of 26 duty ratios 50%
Then pulse maintains the high level of 52 pulse lengths, repeatedly this period;When exporting first pulses low, setting
Controlling of sampling variable is low level, is sampled when from second pulses low, and until the 26th pulses low, sampling terminates,
Controlling of sampling variable reverts to high level;S is arranged GPIO rising edge and interrupts service function, is low level in controlling of sampling variable
When, to data sampling, acquire 25 data, high position data is preceding, and low data is in rear, composition data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811646009.4A CN109814441A (en) | 2018-12-30 | 2018-12-30 | A kind of method that STM32 microcontroller receives absolute encoder data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811646009.4A CN109814441A (en) | 2018-12-30 | 2018-12-30 | A kind of method that STM32 microcontroller receives absolute encoder data |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109814441A true CN109814441A (en) | 2019-05-28 |
Family
ID=66603782
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811646009.4A Pending CN109814441A (en) | 2018-12-30 | 2018-12-30 | A kind of method that STM32 microcontroller receives absolute encoder data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109814441A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110879298A (en) * | 2019-11-07 | 2020-03-13 | 上海新时达机器人有限公司 | Speed acquisition method based on communication type encoder |
CN111207771A (en) * | 2019-12-31 | 2020-05-29 | 中国船舶重工集团公司第七一七研究所 | High-speed data acquisition and storage device of laser gyroscope |
CN111405286A (en) * | 2020-03-30 | 2020-07-10 | 辽宁航空智能制造研究院有限公司 | Self-adaptive coding and decoding double-line information transmission method and device |
CN111693075A (en) * | 2020-07-09 | 2020-09-22 | 赛卓微电子(深圳)有限公司 | Method for outputting absolute position in incremental encoder IC |
CN112600807A (en) * | 2020-12-03 | 2021-04-02 | 航宇救生装备有限公司 | Wireless acquisition method of synchronous serial interface encoder |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060060764A1 (en) * | 2004-09-20 | 2006-03-23 | Anton Rodi | Encoder with absolute signal processing and incremental signal output and method of using such an encoder |
CN103528600A (en) * | 2013-10-30 | 2014-01-22 | 天津市津达执行器有限公司 | Execution mechanism position conversion module for supporting Gray code encoder |
CN103792939A (en) * | 2014-01-28 | 2014-05-14 | 合肥三立自动化工程有限公司 | Absolute value encoder signal measuring and control instrument and detection method thereof |
CN104536330A (en) * | 2014-11-13 | 2015-04-22 | 河北工业大学 | Data communication device for absolute value encoder with SSI |
-
2018
- 2018-12-30 CN CN201811646009.4A patent/CN109814441A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060060764A1 (en) * | 2004-09-20 | 2006-03-23 | Anton Rodi | Encoder with absolute signal processing and incremental signal output and method of using such an encoder |
CN103528600A (en) * | 2013-10-30 | 2014-01-22 | 天津市津达执行器有限公司 | Execution mechanism position conversion module for supporting Gray code encoder |
CN103792939A (en) * | 2014-01-28 | 2014-05-14 | 合肥三立自动化工程有限公司 | Absolute value encoder signal measuring and control instrument and detection method thereof |
CN104536330A (en) * | 2014-11-13 | 2015-04-22 | 河北工业大学 | Data communication device for absolute value encoder with SSI |
Non-Patent Citations (1)
Title |
---|
张子蓬等: "SSI接口的绝对值角度编码器值的读出方法研究", 《工业控制计算机》 * |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110879298A (en) * | 2019-11-07 | 2020-03-13 | 上海新时达机器人有限公司 | Speed acquisition method based on communication type encoder |
CN110879298B (en) * | 2019-11-07 | 2022-01-14 | 上海新时达机器人有限公司 | Speed acquisition method based on communication type encoder |
CN111207771A (en) * | 2019-12-31 | 2020-05-29 | 中国船舶重工集团公司第七一七研究所 | High-speed data acquisition and storage device of laser gyroscope |
CN111405286A (en) * | 2020-03-30 | 2020-07-10 | 辽宁航空智能制造研究院有限公司 | Self-adaptive coding and decoding double-line information transmission method and device |
CN111405286B (en) * | 2020-03-30 | 2023-11-03 | 沈阳航空产业技术研究院有限公司 | Self-adaptive coding and decoding double-line information transmission method and device |
CN111693075A (en) * | 2020-07-09 | 2020-09-22 | 赛卓微电子(深圳)有限公司 | Method for outputting absolute position in incremental encoder IC |
CN112600807A (en) * | 2020-12-03 | 2021-04-02 | 航宇救生装备有限公司 | Wireless acquisition method of synchronous serial interface encoder |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109814441A (en) | A kind of method that STM32 microcontroller receives absolute encoder data | |
CN104954096A (en) | One-master multi-slave high-speed synchronous serial communication data transmission method | |
CN203084482U (en) | Signal acquisition device of synchronous serial output shaft encoder | |
CN105471573A (en) | Method and device for serial data transmission over a bidirectional data channel | |
CN105119907A (en) | FPGA-based BiSS-C communication protocol method | |
CN101957806B (en) | Peripheral component interconnection standard acquisition device for synchronous serial interface signal | |
CN101604161A (en) | Bit synchronization decoding method | |
CN101431389B (en) | Circuit and its signal transmission method | |
CN102170326B (en) | Serial communication method of position measuring equipment and device thereof | |
CN111726115A (en) | Frequency division and counting system and method for pulse signals of rotary pulse encoder | |
CN104104288A (en) | Detection device and processing method of high-speed motor rotor position | |
CN213363816U (en) | Multi-protocol compatible angle acquisition system | |
CN104536330A (en) | Data communication device for absolute value encoder with SSI | |
CN202004710U (en) | Alternating-current servo controller using electronic transmission ratio | |
CN103501137A (en) | Rapid and high-precision location information acquiring system for permanent magnet synchronous motor | |
CN103454951A (en) | Synchronous serial communication interface device | |
CN103199977A (en) | Synchronous sequence data transmission method and circuit device | |
CN102970300A (en) | Asynchronous communication protocol | |
CN105635130A (en) | Multiprotocol compatible multipath signal acquisition system | |
CN103577485A (en) | Master and slave mode inquiry system and method | |
CN102571518A (en) | Electronic transformer data transmission method based on field bus | |
CN204612811U (en) | Support the intelligent multi-channel temperature transmitter of FF agreement | |
CN107703919B (en) | Data acquisition device, control system comprising same and communication method | |
CN201378059Y (en) | Motor shaft solid shaft rotary encoder | |
CN202500555U (en) | Data transmission system in petroleum logger |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190528 |
|
RJ01 | Rejection of invention patent application after publication |