Scolling LED's


Closed Thread
Results 1 to 3 of 3

Thread: Scolling LED's

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,358

    Default Scolling LED's

    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

  2. #2
    Join Date
    May 2008
    Location
    Florida
    Posts
    64


    Did you find this post helpful? Yes | No

    Thumbs up

    Melanie
    Thanks for putting this on the forum. Good example for us noobs. Might I suggest a copy in Code Examples?

    Ted

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default Not for the noobs...

    12 words program from DT and Bruce awhile back...amazing...

    http://www.picbasic.co.uk/forum/show...hlight=contest

Similar Threads

  1. Run a string of LEDs from the mains
    By The Master in forum Off Topic
    Replies: 30
    Last Post: - 1st October 2009, 18:55
  2. output port issues driving LEDs
    By p15218 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th August 2008, 21:42
  3. Using LEDs as light sensors
    By skimask in forum Code Examples
    Replies: 3
    Last Post: - 30th December 2006, 22:19
  4. controlling leds with the switches
    By ilteris in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th October 2005, 21:02
  5. Replies: 5
    Last Post: - 16th February 2005, 11:57

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts