Need a bit of help with a PLC program

I've simulated this using a 1500plc and timed interrupts but the principle should be the same using hardware interrupts in your S7-1200

The 1st screenshot is the logic for interrupt field1 right? What do you do in the 1st network of the 2nd screenshot?
 
Last edited:
Yes, first post is the start of the timing, second post is the end of timing. The first network is blank from when the block was created.
 
Last edited:
Yes, first post is the start of the timing, second post is the end of timing. The first network is blank from when the block was created.

I find it a bit odd that you start a timer in the 2nd screenshot, isn't that supposed to stop the timer and how long does that timer run?
 
Last edited:
The second block keeps the timer going and reads the elapsed time. The timer is only started in the first block. If you stop a TON timer the elapsed time resets to zero.

TON.jpg
 
Last edited:
The second block keeps the timer going and reads the elapsed time. The timer is only started in the first block. If you stop a TON timer the elapsed time resets to zero.


(2nd screenshot) I see that you set a bit in the 1st network which starts the timer in the 2nd network but isn't that timer going to give a wrong elapsed time when you enter the SUBTRACT block because the timer never resets so the ET keeps going right? Or I just don't understand how an interrupt works
 
Last edited:
Interrupts only execute instructions when the event causing the interrupt occurs.


The timer starts by detecting a rising edge on it's input, hence the two calls to the timer. The timer reads the system clock and stores it internally to perform timing functions.



When the timer is called in the second block, it reads the system time to determine how long has elapsed since the previous call and updates the elapsed time.


You could have done this "manally" by reading the system time in the interrupt blocks and calculating the elapsed time. The timer provides a convenient wrapper for determining the elapsed time.
 
Okay I think I understand, thank you very much! I will send the screenshots of my direction detection program later. I think I might have it but I'm not sure.
 
Direction of the ball
I set the timer using the fieldsensor of player 1 and reset it using the goalsensor of player 1 or the opposing fieldsensor of player 2.
What I need to do for the direction is:
1) when I get 2 signals on the fieldsensor1 or fieldsensor2 in a row the timer has to reset.
2) When I get a signal on one of the goalsensors following with a signal on the according fieldsensor ( so the ball bounces out of the goal and crosses the fieldsensor again) I have to ignore that signal and prevent the timer from starting again.

I currently have this: https://ibb.co/kW4yHd

I have to move the time using a negative edge on the goalsensor so ignore the 3rd network.
 
Last edited:
Here's my state diagram - state 0 is when you start with the ball in the centre of the pitch. At each interrupt read the system time and store it. When you get to a state where the speed can be calculated, find the difference in the times.

state.jpg
 
How does the ball get out of the goal - removed by hand or falls through a hole?

The ball rolls through the goal in the basket, you can take the ball out of the basket using your hands. But sometimes the ball goes that hard that it bounces out of the goal and back on the field.
 
Here's my state diagram - state 0 is when you start with the ball in the centre of the pitch. At each interrupt read the system time and store it. When you get to a state where the speed can be calculated, find the difference in the times.

I don't really understand what you're trying to do with that drawing :p
When one of the field sensors receive a signal 2 times in a row ( ball crosses the sensor, bounces next to the goal and crosses the sensor again) I have to reset the timer.
 

Similar Topics

I'm trying to display a 32 bit word from my PLC (ProWorx32), which I have used a double precision add block to achieve. The problem is, even...
Replies
4
Views
2,463
I need help converting from a floating register to two integer words. I'm using a SLC 5/05 and need to be able to write 32 bit data to a servo...
Replies
2
Views
4,706
Can anyone explain to me how does the address scheme for a bit data file works? For example, B3:400 and B3/47 I am using the PLC 3rd edition by...
Replies
1
Views
3,513
I have this SLC 5/03 file attached. I don't own RS Logix software myself, but I'd like to be able to check out a few things in the program. I'm...
Replies
6
Views
2,643
Question- Say I have 8 digital INPUTS to my PLC, any of which may be asserted HIGH for a few seconds, all these inputs "OR'd", currently, to...
Replies
16
Views
3,535
Back
Top Bottom