Hi Melanie,
I would like ask for your help.
I have 8 LED diodes which are connected to PORTB of microchip PIC18F877, 8 toggle switches connected to PORTD for changing state of each LED diode and 2 toggle switches connected to PORTC.0, PORTC.1 for scrolling LED diodes to right and left. Not all diodes are switch on, sometimes is switch on diode of PORTB.0, PORTB.3 and PORTB.7, it deepens on conditions. Time delay for scrolling is 20ms.
My question is.
How can I scrolling LED diodes of PORTB to right and left in picbasic?
DO NOT Message me with your requests - keep them on the forum!
Code:
'
' Defines & Variables
' -------------------
ScrollRight var PortC.0
ScrollLeft var PortC.1
Mirror var Byte
Temp var Bit
TRISB=%00000000
TRISC.0=1
TRISC.1=1
TRISD=%11111111
' Put statements to Turn-Off ADC and Comparators here
Start:
'
' Read PortD Presets into Variable
' --------------------------------
Mirror=PortD
Loop:
'
' Output Variable to LED's
' ------------------------
PortB=Mirror
Pause 20
'
' Check for Scroll Right
' ----------------------
If ScrollRight=0 then
Temp=Mirror.0
Mirror=Mirror>>1
Mirror.7=Temp
endif
'
' Check for Scroll Left
' ---------------------
If ScrollLeft=0 then
Temp=Mirror.7
Mirror=Mirror<<1
Mirror.0=Temp
endif
Goto Loop
Bookmarks