11/16/2021 10:58 AM | |
Joined: 11/2/2021 Last visit: 11/16/2022 Posts: 3 Rating:
|
This is not a school project. A few years ago, I studied a little at school about the S7-1200. Now I am programming atmega microcontrollers but I would like to start using a PLC. I enabled HSC1 and HSC2. From another controller, I send pulses to s7 at regular intervals. I run the trigger from S7 with the TP block in Main[OB1]. Reading from encoders (atmega driver) in hardware interrupts [BO40 and OB 41]. When the sensor detects an object, it counts the pulses from the first encoder (countFrom1stEncoder) to a predetermined value (setPulsesFrom1stEnc). Then I set flag setPulsesFrom2ndEnc and count pulses from 2nd encoder. When the sensor is falling it counts a few more pulses (setPulsesAfterSensorFalling). All the pulses it counts must be triggered immediately. I noticed that the results are worse if I set the trigger time to 1ms, it is better with 2ms but I want to get good results with a maximum time of 1ms. By the way, is it possible to set the TP time <1ms? 900us, 800us? Below I am attaching photos of the program and the results. Attachmentv1.3.zip (394 Downloads) |
Follow us on