Need help with Counter/Timer application


Results 1 to 22 of 22

Threaded View

  1. #4
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Hi Russ,

    Something like below could work for you but it is just an example to show the idea.

    Same concept could be applied to a Timer module of the PIC.



    Code:
    DEFINE OSC 20
    
    TRISB = %00000000
    PORTB = 0
    
    Relay1     VAR PORTB.0  'A relay is driven through PORTB.0
    Relay2     VAR PORTB.1
    Relay3     VAR PORTB.2
    
    RUSS_Timer var word     'A timer variable 
    RUSS_Match var word     'A variable to match timer with stored variables in Lookdown Table.
    
    
    Begin:
    
       Russ_Timer = 0
       RUSS_Match = 0
    
    
    Start:
    
       PAUSE 100   'You need 100ms of time intervals.
       RUSS_Timer = Russ_Timer + 1
       
       LOOKDOWN RUSS_Timer ,[34,46,49,112,119,122,123,124,156,189,205,235],RUSS_Match     'Get an index value from the timer. Ad d more...
    
       BRANCHL  RUSS_Match, [Run_RED, Run_Green, Run_Blue, Run_last]     'Go run the matching set of instructions. Add more....
       
    
       goto start
    
    
    Run_Red:
    
       high relay1
       goto start
       
    Run_Green:
    
       high relay2
       low  relay1
       goto start
    
    Run_Blue:
    
       TOGGLE relay3
       low relay2
       goto start
       
    Run_Last:
    
       PORTB = 0
       goto begin  'Reset All.
       
    
    
    END
    Last edited by sayzer; - 30th August 2006 at 11:27.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

Similar Threads

  1. Simple TMR1 application example needed
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th February 2010, 09:52
  2. Unusual Interrupts Application Problem
    By Joe Rocci in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th May 2009, 11:55
  3. PIC16F877A for application in mobile robot...
    By mcbeasleyjr in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th January 2009, 14:47
  4. DS1307 automotive application
    By DynamoBen in forum Schematics
    Replies: 10
    Last Post: - 31st August 2006, 00:33
  5. Timer Application
    By charudatt in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th February 2004, 06:05

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