Hi,
I have a program running on a 16F88 that controls a stepper motor.
I now want to change it's speed (ie. delays) in ten increments using a button.
The button press should count up to ten (1001) and then reset to 1(0000).
on each level a different delay should be used between each step of the motor.
ie.
if Button_count = 0000
delay = 11mS
...
if Button_count = 1001
delay = 1mS
Loop
Step 1
call delay
Step 2
call delay
Step 3
call delay
Step 4
call delay
goto Loop
Now the problem is, I have no idea how to increment a counter with a button and secondly, I have no idea how to enable the button to be pressed at any time and have the µController reset the delay.
I suspect interrupts, but I have no clue how to set it up on the 16F88.
I'm relatively new to assembly so I'm struggling a bit with this.
Also, before the loop restarts after the delay has been given a new value, I need to turn on 4 LEDs that display the speed level in binary, how can I reference this from the delay/Button_count?
Any and all help will be appreciated, even if you can only point me in the right direction.
This has to be handed in on Friday, so I'm in a bit of a jam.
I have a program running on a 16F88 that controls a stepper motor.
I now want to change it's speed (ie. delays) in ten increments using a button.
The button press should count up to ten (1001) and then reset to 1(0000).
on each level a different delay should be used between each step of the motor.
ie.
if Button_count = 0000
delay = 11mS
...
if Button_count = 1001
delay = 1mS
Loop
Step 1
call delay
Step 2
call delay
Step 3
call delay
Step 4
call delay
goto Loop
Now the problem is, I have no idea how to increment a counter with a button and secondly, I have no idea how to enable the button to be pressed at any time and have the µController reset the delay.
I suspect interrupts, but I have no clue how to set it up on the 16F88.
I'm relatively new to assembly so I'm struggling a bit with this.
Also, before the loop restarts after the delay has been given a new value, I need to turn on 4 LEDs that display the speed level in binary, how can I reference this from the delay/Button_count?
Any and all help will be appreciated, even if you can only point me in the right direction.
This has to be handed in on Friday, so I'm in a bit of a jam.