The worst programmer ever to grace this forum - ME!


Results 1 to 40 of 50

Threaded View

  1. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Here, this chaser works with the hardware you are using:
    MPASM required, you must comment out the config in the .inc file for 16f690 in PBP root.
    Code:
    @MyConfig = _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON  
    @MyConfig = MyConfig & _MCLRE_ON & _BOR_OFF 
    @ __config  MyConfig 
    
    DEFINE OSC 4
    PortA = 0
    PortB = 0
    PortC = 0
    TRISA = 0
    TRISB = 0
    TRISC = 0
    i var byte
    
    main:
    portc = 0
    pause 500
    for i = 1 to 15; step -1
    portC = i
    i=i  << 1 
    pause 250
    next i
    goto main
    end
    Here's a blinkey:
    Code:
    DEFINE OSC 4
    PortA = 0
    PortB = 0
    PortC = 0
    TRISA = 0
    TRISB = 0
    TRISC = 0
    
    LED_1 var PortC.0 ' Define an alias in the program
    led_1 = 0
    
    Main:
    HIGH LED_1
    PAUSE 1000
    LOW LED_1
    PAUSE 1000
    Goto Main ' Loop forever
    end
    OK here is your code reworked:
    Code:
    DEFINE OSC 4
    LED_1 VAR BIT  ' PORT FLAG BIT
    LED_1 = 0      ' SET INITIAL VALUE
    TRISC.0 = 0 ' Make PORTC.0 an output
    
    
    Main:
    IF LED_1 = 0 THEN
    LED_1=1
    ELSE
    LED_1 = 0
    ENDIF
    PORTC.0 = LED_1
    
    
    
    
    PAUSE 250 ' Delay for 1 second (compiler errors with this line - I guess the command isn't right!)
    Goto Main ' Loop forever
    It appears as though the PIC cannot read and change it's own output without an intermediary like a flag variable. Probably
    A RMW thing, I do not know.
    Last edited by Archangel; - 14th March 2009 at 02:07.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. Melabs U2 Programmer Command Line Options
    By Robert Wells in forum General
    Replies: 5
    Last Post: - 3rd July 2009, 02:11
  2. problems with USB programmer
    By malc-c in forum General
    Replies: 7
    Last Post: - 10th May 2007, 20:14
  3. USB programmer problems
    By uiucee2003 in forum USB
    Replies: 2
    Last Post: - 15th August 2006, 23:47
  4. General Programmer Questions
    By mslaney in forum General
    Replies: 1
    Last Post: - 17th December 2004, 18:16

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