Timer problem


Closed Thread
Results 1 to 3 of 3

Thread: Timer problem

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Posts
    6

    Default Timer problem

    I want to make timer. When time is 0 sec, timer give log 1 on some port.
    I probe many mode, but nothing is good. I use 7 segment display.
    This is shematic
    http://www.elecfree.com/electronic/w...lock-timer.gif
    Can some body help me to do this.
    I taste this : "If time=0 then porta.0 = 0" but not working

    Code:


    include "modedefs.bas"

    trisb=0
    cmcon=7
    i var byte
    j var byte
    Number var word
    Time var word
    a var byte
    b var byte
    c var byte
    d var byte

    time = 40

    goto Begin


    Digit:
    lookup i,[63,6,91,79,102,109,125,7,127,111],j
    return
    Begin:
    number=time
    d=number/1000
    broj=broj-d*1000
    c=number/100
    broj=number-c*100
    b=broj/10
    a= number-b*10

    i=a
    gosub Digiti
    low porta.4
    portb=j
    high porta.1
    pause 1
    i=b
    gosub digit
    low porta.1
    portb=j
    high porta.2
    pause 1
    i=c
    gosub digit
    low porta.2
    portb=j
    high porta.3
    pause 1
    i=d
    gosub digit
    low porta.3
    portb=j
    high porta.4
    pause 1
    if porta.5 = 0 then
    time = time - 1
    else
    time = time + 10
    endif

    goto begin
    end

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Check your PIC's datasheet. What 'mode' are most pins/ports set to on a power up RESET?
    Then try a 'blinky LED' program...then try to understand YOUR program.

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    I taste this : "If time=0 then porta.0 = 0" but not working
    Which PIC are you using?

    Have you set TRISA.0=0 so PORTA.0 is an output?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 07:56
  3. Timer interrupt frequency
    By Samoele in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th January 2009, 23:49
  4. Interesting delay problem
    By Kreston in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st September 2008, 14:41
  5. Timer problem
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st February 2008, 13:54

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