framenax.blogg.se

Forward and reverse motor control in verilog
Forward and reverse motor control in verilog








forward and reverse motor control in verilog

It makes sense to use a counter, but that’s not the only way to set it up. There are several ways you could do this. Suppose you want the robot to go slowly each time it changes direction, but if it makes it through three loops (or clock cycles, if you prefer) without hitting something, the robot should speed up. Hardware implementations use flip flops and there are at least two different ways to construct a state machine. Table.next_state=FORWARD Flip Flop Hardware

forward and reverse motor control in verilog

For example: table.current_state=FORWARD If (state=FORWARD) move_forward() else move_backward() Īnother way to get the same effect is to write a program that reads the data from a table that matches input and current state to find the next state. If (state=FORWARD) state=REVERSE else state=FORWARD A software version of the robot state machine might look like this: state = FORWARD You can implement a state machine in software or hardware. Part of this is understanding and part is knowing about the tools you can choose to use.

forward and reverse motor control in verilog

If you master state machines your design and debug cycles will both move along faster. The switchboard also has to have states for timeouts, connection failures, three way calling, and more. If the state is idle, the phone gets a dial tone. If the state is ringing, picking up the phone makes a connection. The reaction to a phone going off hook depends on the state of the line. For example, consider a phone switchboard. Many state machines have lots of states with complex conditions. That is, the outputs of the machine (motor drive) depend not only on the inputs (the bump sensor) but also on the current state of the machine (going forward or backward).Īs state machines go, that’s not an especially complicated one. This robot exhibits behavior that is easy to model as a state machine. If it had been going forward, a bump will send it backwards and vice versa. The response to the bump sensor activating depends on the previous state of the robot. Imagine a robot with an all-around bump sensor.










Forward and reverse motor control in verilog