Stupid Blinking LED Question


Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Aug 2008
    Posts
    13

    Default Stupid Blinking LED Question

    I'm using PBP V3 and a PIC18F46K22.

    Before I do anything I make a simple program to flash between 2 different LEDs to make sure I have valid code, and I'm running into a simple/stupid problem.


    This code works:
    Code:
    '* Notes : PIC18F46K22 *
    #CONFIG
    CONFIG FOSC = HSMP
    CONFIG PLLCFG = ON
    CONFIG FCMEN = OFF 
    CONFIG BORV = 285
    CONFIG HFOFST = OFF
    CONFIG MCLRE = EXTMCLR
    CONFIG LVP = OFF
    #ENDCONFIG
    Define OSC 64 
    TRISA.0 = 0
    ANSELA.0 = 0
    TRISA.1 = 0
    ANSELA.1 = 0
     
    YLED VAR PortA.0
    LOW YLED 
    GLED VAR PortA.1
    LOW GLED
     
    X VAR LONG
    CLEAR
    :Main
    x=x + 1
    if x > 100000 then
    low YLED 
    high GLED 
    else
    high YLED 
    LOW GLED
    endif
    if x > 200000 then
    x=0
    endif
    goto Main
    This code doesn't:
    Code:
    '* Notes : PIC18F46K22 *
    #CONFIG
    CONFIG FOSC = HSMP
    CONFIG PLLCFG = ON
    CONFIG FCMEN = OFF 
    CONFIG BORV = 285
    CONFIG HFOFST = OFF
    CONFIG MCLRE = EXTMCLR
    CONFIG LVP = OFF
    #ENDCONFIG
    Define OSC 64 
    TRISA.0 = 0
    ANSELA.0 = 0
    TRISA.1 = 0
    ANSELA.1 = 0
     
    YLED VAR PortA.0
    LOW YLED 
    GLED VAR PortA.1
    LOW GLED
     
    X VAR LONG
    CLEAR
    :Main
    x=x + 1
    if x > 100000 then
    YLED = 0
    GLED = 1 
    else
    YLED = 1
    GLED = 0 
    endif
    if x > 200000 then
    x=0
    endif
    goto Main
    The only thing I'm changing is setting GLED or YLED = 0 or 1 vs using High and Low

    WTF am I missing?
    Last edited by bradb; - 6th September 2011 at 16:15.

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