Hi, I'm pretty new to all this, having recently bought a Velleman VM111 programmer board and PIC 16F627 chip. I am working in assembly language.
My plan is to have a stepper motor rotate a turntable to predefined positions. I can drive the motor and I can place positions in EEprom as the number of steps from my zero position.
I can put things into EEPROM and access them, I can drive a stepper motor in both directions.
I am currently slightly clueless as to how I move the motor from one position to the next.![Confused :confused: :confused:](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
For example:
If position 1 is at step 24 (90 degrees from zero [the motor has 3.75 degree steps])
and pos 2 is at step 32 (120 degrees), then I want the motor to move 8 steps clockwise.
If position 3 is at step 4 (15 degrees from zero) then the motor would be best moving anticlockwise 28 steps as opposed to continuing clockwise for 76 steps.
I hope this is clear!
Am I right in thinking I can't have negative binary numbers?
I know SUBLW will come into is somewhere, but what happens if I subtract a large number from a small one?
How can I find out which number is the larger?
Do I need "If, Then and Else"? I assume they exist in assembly language?
Any pointers would be more than welcome, but please remember that I am new to all this and the learning curve, though fun, is steep.
My plan is to have a stepper motor rotate a turntable to predefined positions. I can drive the motor and I can place positions in EEprom as the number of steps from my zero position.
I can put things into EEPROM and access them, I can drive a stepper motor in both directions.
I am currently slightly clueless as to how I move the motor from one position to the next.
For example:
If position 1 is at step 24 (90 degrees from zero [the motor has 3.75 degree steps])
and pos 2 is at step 32 (120 degrees), then I want the motor to move 8 steps clockwise.
If position 3 is at step 4 (15 degrees from zero) then the motor would be best moving anticlockwise 28 steps as opposed to continuing clockwise for 76 steps.
I hope this is clear!
Am I right in thinking I can't have negative binary numbers?
I know SUBLW will come into is somewhere, but what happens if I subtract a large number from a small one?
How can I find out which number is the larger?
Do I need "If, Then and Else"? I assume they exist in assembly language?
Any pointers would be more than welcome, but please remember that I am new to all this and the learning curve, though fun, is steep.