Remembering I'm a novice and a bit of an old fart .. ... .
I'm having a play with stepper motors at the moment - I want to get some experience of how they work etc .. . I've got some steppers I saved from some old printers etc and I've identified them to type and found datasheets, so far so good.
I found a schematic to drive a stepper with a PIC 16f877A which I've now part built but the narrative says there is a 'switch' on the 16f877a which at logic high will drive in one direction and logic low the opposite direction. I've looked at the schematic and studied the datasheet but I cannot identify which pin is this switch - I find some of the abbreviations to pin labels a bit odd - .. .. ..
FWD_REV is the software flag. It could just as easily be a physical switch that the user controls; although, in that case you would probably want it set to toggle so it didn't have to be held in a particular position.
When it is "clear", the the sequence of drive signals are 1,2,3,4 ... (i.e., "incf State") ; when it is "set", the sequence is 4,3,2,1 ... (i.e, decf State). That later sequence is what I call "reverse, and the spindle of the motor rotates CCW.
I haven't done any coding yet, barring copying a .hex into my programmer and loading to a chip - if it doesn't work I practice my drop kicks ready for Sept. and try another one ! Is MikroC not the accepted or usual code for PICs then ?
I have had a look at the list file and did a search for "PORT" I could not find any instruction that read any port so I think the code is just a sample to modify to suit your requirements. The code also steps very slowly as there is a delay of 500 mS between steps.
Quite the contrary. I think several members here use it in preference to other versions. A dwindling few of use use Assembly, including myself.
In my link, I even link to the Mikro site. There is also a link to two Microchip application notes that use Assembly. That code is quite straight forward.
I'm just reading your article now .. and I've got Nigel's tutorials on my todo list ..
Trouble is .. there is so much I want to do - I end up spending most of my time trying to decide which to do first .. .. EDC !
I'm sure I'll find some code in a library somewhere that will make this work for now .. . Coding is a major issue for me at the moment and slightly away from my current goal - but I'll get there in the end .. .. .. and I'm consoled by the fact that it's such a lovely place to get there !!