Hello Thrix,
A couple of more things.
1. I was able to do a For/Next loop, and shift 5 times, but I could not include the very first shift, because I did not know if you had to "Toggle" the port in that sequence.
the First time you toggled, (the I loop) you toggled P.4, P.3, P.2, P.1,P.0, in that order. The rest of the times you toggled them exactly backwards. P.0,P.1,P.2,P.3,P.4.
I looped the ones you toggled backwards together, and put if statments in them. I couldn't loop the very first one, because I do not know if you can toggle them the other way.
2. I wrote the *if* statements in a different langauge. I do not know the exact structure of the if statement for what you are using. This means you will have to convert my if statement to yours. For example;
if(counter==1)
{
..........
} else
{
.......
}
Might be converted to your if statement as:
if (counter=1)
Begin
.......
else
.......
endif
3. If it doesn't matter on the very first loop whether you toggle the ports 0-4 or 4 - 0 , You can include that into my loop by adding just one if statement and making the counter go from 0 to 5, instead of 1 to 5, and get rid of another loop and simplify it even more.
Here is a shorter , more simplified program....
I VAR WORD 'DELAY FOR ALL COLUMN DISPLAY
counter var word'
TRISA = 255
TRISB = 0
MAIN:
FOR I = 0 TO 25
' DISPLAYING AT ALL COLUMN
PORTB = $7F ''''''''''''''''''
GoSub TogPA4
PORTB = $8
GoSub TogPA3
PORTB = $8
GoSub TogPA2
PORTB = $8
GoSub TogPA1
PORTB = $7F 'STARTING POINT
GoSub TogPA0
NEXT I
'Lets shift!
For counter=1 to 5
For J = 0 TO 25
if(counter==4)
{
PORTB = $7
GoSub TogPA0
}else if(counter!=5)
{
PORTB = $8
GoSub TogPA0
}
if((counter==3) or (counter==5))
{
PORTB = $7
GoSub TogPA1
}else if(counter!=4)
{
PORTB = $8
GoSub TogPA1
}
if((counter==2) or (counter==4))
{
PORTB = $7
GoSub TogPA2
}else if(counter!=3)
{
PORTB = $8
GoSub TogPA2
}
if((counter==1) or (counter==3))
{
PORTB = $7
GoSub TogPA3
}else if(counter!=2)
{
PORTB = $8
GoSub TogPA3
}
if(counter==2)
{
PORTB = $7
GoSub TogPA4
}else if(counter!=1)
{
PORTB = $8
GoSub TogPA4
}
NEXT j
Next counter
goto MAIN
;subroutines!!!!!!!!!!
TogPA4:
LOW PORTA.4 ' END POINT '
PAUSE 3 ' '
HIGH PORTA.4 ''''''''''''''''''
return
TogPA3:
LOW PORTA.3
PAUSE 3
HIGH PORTA.3
return
TogPA2:
LOW PORTA.2
PAUSE 3
HIGH PORTA.2
return
TogPA1:
LOW PORTA.1
PAUSE 3
HIGH PORTA.1
return
TogPA0:
LOW PORTA.0
PAUSE 3
HIGH PORTA.0
return
' Go back to loop and blink LED forever
End
Bookmarks