Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

I've posted a win a Firefly PCB on my site

Status
Not open for further replies.
Here's a program that flashes the Firefly LEDs from right (red) to left (green)
Ok I need a program to remove tabs... I think I recall one here somewhere...
Note: MPLAB 7.50 works fine.

Code:
    LIST p=16F88
    INCLUDE "p16f88.inc"    
    ERRORLEVEL 0, -302

    __CONFIG _CONFIG1, 0x2F30
       __CONFIG _CONFIG2, 0x3FFC
    
movlf         macro     x,y            ;MACRO move literal to file register W = literal
            movlw     x
            banksel y            ;make sure it's in the right bank
            movwf     y
            endm                ;end macro
    
    cblock    0x20                ;start of general purpose registers
            Delay_Count            ;delay counter
    endc

    org 0x000                    ;this is where the program starts running    
    movlf    0x07, CMCON            ;turn comparators off (make it like a 16F84)
    movlw     b'11111111'            ;I/O direction (inputs)
    banksel TRISB                ;switch to bank 1
      movwf     TRISB                ;set PortB all inputs
    movwf    TRISA                ;set PortA all inputs

Red1                            ;LED1 RED
    movlf    b'01000000', PORTA
    movlf    b'10111110', TRISA
    call    Delay

Red2                            ;LED2 RED
    movlf    b'10000000', PORTA
    movlf    b'00111111', TRISA
    call    Delay

Red3                            ;LED3 RED        
    movlf    b'00000001', PORTA
    movlf    b'01111110', TRISA
    call    Delay

Green3                            ;LED3 GREEN
    movlf    b'10000000', PORTA
    movlf    b'01111110', TRISA
    call    Delay

Green2                            ;LED2 GREEN
    movlf    b'01000000', PORTA
    movlf    b'00111111', TRISA
    call    Delay

Green1                            ;LED1 GREEN
    movlf    b'00000001', PORTA
    movlf    b'10111110', TRISA
    call    Delay

    goto    Red1
    
Delay                            ;32KHz Clock (default internal OSC speed)
    NOP                            
    DECFSZ  Delay_Count , f
    GOTO    Delay
    RETURN    

    END
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top