bigal_scorpio
Active Member
Hi Burt and all,
Here is my circuit along with a rough idea of what I'm trying to do.
The flap only needs to open about 30 degrees but must open to the same angle every time hence the stepper. I would have liked a micro switch that could detect when the flap was closed and adjust the stepping cycles to suit automatically or maybe another button or combination of buttons to somehow tell the program where to set open and close points, but this is definately beyond me and my small knowledge of programming. Also I forgot to show the 10k pulldown resistor array on the 2803 inputs in the drawing.
Any help or suggestions will be appreciated.
Regards............Al
PS do I need the delays in the prog to be any particular length for best performance? I have found articles about steppers but they are all too technical for me to grasp. Is there an average time for the pulses?
Here is my circuit along with a rough idea of what I'm trying to do.
The flap only needs to open about 30 degrees but must open to the same angle every time hence the stepper. I would have liked a micro switch that could detect when the flap was closed and adjust the stepping cycles to suit automatically or maybe another button or combination of buttons to somehow tell the program where to set open and close points, but this is definately beyond me and my small knowledge of programming. Also I forgot to show the 10k pulldown resistor array on the 2803 inputs in the drawing.
Any help or suggestions will be appreciated.
Regards............Al
PS do I need the delays in the prog to be any particular length for best performance? I have found articles about steppers but they are all too technical for me to grasp. Is there an average time for the pulses?
Code:
program stepperNOW630
main:
DIM t as byte
TRISA = %00000000
PORTA = %00000000
TRISC = %00110000
PORTC = %00000000
CMCON =0x07
IF (BUTTON(PORTC,5,1,0))then GOTO up
END IF
IF (BUTTON(PORTC,4,1,0))then GOTO down
END IF
GOTO main
up:
FOR t = 1 to 50
PORTA = %00000001
PORTC = %00000001
delay_ms (10)
PORTA = %00000011
PORTC = %00000000
DELAY_MS (10)
PORTA = %00000110
PORTC = %00000000
delay_ms (10)
PORTA = %00000100
PORTC = %00000001
DELAY_MS (10)
NEXT t
GOTO main
down:
FOR t = 1 to 50
PORTA = %00000100
PORTC = %00000001
delay_ms (10)
PORTA = %00000110
PORTC = %00000000
DELAY_MS (10)
PORTA = %00000011
PORTC = %00000000
delay_ms (10)
PORTA = %00000001
PORTC = %00000001
DELAY_MS (10)
NEXT t
GOTO main
end.
Attachments
Last edited: