Lab X1 and 16F877 examples for beginners


Results 1 to 7 of 7

Threaded View

  1. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: Lab X1 and 16F877 examples for beginners

    Code:
    '*****************************************************************
    '*  Name     : LAB X1 LEDs 2.BAS           Version : 1.0         *
    '*  Author   : Demon                Date    : 2012-01-06  *
    '*  Task     : Blink LEDs back and forth                         *
    '*  Hardware : PIC 16F877, 20mhz crystal                         *
    '*           : Lab X1 Experimental Board                         *
    '*           : MeLabs U2 Programmer v4.32                        *
    '*  Software : PIC Basic Pro v2.60C                              *
    '*           : MicroCode Studio Plus v2.2.1.1                    *
    '*           : MeLabs PM Assembler                               *
    '*****************************************************************
    'define  LOADER_USED 1
    @ DEVICE PIC16F877, HS_OSC, WDT_OFF, PWRT_ON, BOD_ON, LVP_OFF, CPD_OFF, WRT_OFF, DEBUG_OFF, PROTECT_OFF
    
    define  OSC 20
    
    TRISD = %00000000                   ' Set all port D pins to output
    ADCON1 = 7                          ' A/D off, all digital
    
    WSLOOP  var byte                    ' Loop counter
    
        PORTD = %00000001               ' Turn 1st LED on
        pause 100                       ' Short delay
    
    CYCLE:
        for wsloop = 1 to 7             ' Turn on next LED from right to left
            PORTD = PORTD << 1
            pause 100
        next
        for wsloop = 1 to 7             ' Turn on next LED from left to right
            PORTD = PORTD >> 1
            pause 100
        next
    
        GOTO    CYCLE
        end
    Last edited by Demon; - 4th October 2016 at 17:21.

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