Hi Bob,

(EDIT: sayzer beat me to it but I'll post this anyway)

Several ideas....but they depend a bit on how you have the thyristors connected to the PIC. The "best" would be if they where connected to consecutive pins on a port, like PortC.0 to PortC.5 or PortB.2 to PortB.7 etc.

Without knowing that, here's one way. Create an index variable or "pointer" if you like that you cycle thru 0,1,2,3,4,5 or 5,4,3,2,1,0 depending on direction. Then use a SELECT CASE statement with your index variable and 6 different cases, all quite similar to each other but with the different thyristors firing. But use a FOR-NEXT loop instead of 5 discrete on-off pulse cycles. Something like this:
Code:
Index VAR BYTE
Fire VAR BYTE
Direction VAR BYTE
Forward CON 1
Reverse CON 255

Direction = Forward

Select Case Index

Case 0
  For Fire = 0 to 4
    High Thy1
    High ThY5
    PauseUs 200
    Low Thy1
    Low Thy5
    PauseUs 200
  NEXT
  Index = Index + Direction
  If Index = 255 then Index = 5    ' We're going backwards, start over at step 5

Case 1
  For Fire = 0 to 4
    High Thy1
    High Thy6
    PauseUs 200
    Low Thy1
    Low Thy6
    PauseUs 200
  Next
  Index = Index + Direction

' Case 2,3 and 4 all similar to Case 1

Case 5
  For Fire = 0 to 4
    High Thy3
    High Thy5
    PauseUs 200
    Low Thy3
    Low Thy5
    PauseUs 200
  Next
  Index = Index + Direction
  If Index = 6 then Index = 0    ' We're going forward, start over at step 0

END SELECT
All untested code but I hope it can serve as a starting point. If you do have the thyrsitor across a single port then a lookup table and a single FOR-NEXT loop can replace the above.

HTH,
/Henrik.