Using PIC16F84A as a timer for several I/O


Closed Thread
Results 1 to 8 of 8
  1. #1

    Default Using PIC16F84A as a timer for several I/O

    Hello everyone,
    i want to use PIC16F84A as a timer,
    basically im wokring on a sun-tracking system for solar panels which use LDRs to comapre light intensity and motors to move the panel accordingly.
    Now the problem is that i have to move the solar panel in both azimuth and vertical directions, so i was thinking, instead of using two separate circuits for the directions i use a timer circuit instead.

    The timer circuit's function would be to turn on 2 LDRs, and the motor for vertical direction for about 1 minute, and then switches to 2 LDRs and motor for the azimuth direction

    i would appreciate if anyone can help me with this issue, or pls refer me to a project in this forum of the similar nature

    Thank You

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Default

    ... lots of timer examples in the Example Code Section. See these for example:

    http://www.picbasic.co.uk/forum/showthread.php?t=2129
    http://www.picbasic.co.uk/forum/showthread.php?t=190
    http://www.picbasic.co.uk/forum/showthread.php?t=632

    there are more in that section as well.
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Do you really want the device to work on one for a minute and then the other? Or make the adjustment then wait for a minute before the other adjustment is made?

    Start:
    Vertical routine
    pause for 1 minute
    azimuth routine
    pause for 1 minute
    Goto Start
    Dave
    Always wear safety glasses while programming.

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Do you really want the device to work on one for a minute and then the other? Or make the adjustment then wait for a minute before the other adjustment is made?

    Start:
    Vertical routine
    pause for 1 minute
    azimuth routine
    pause for 1 minute
    Goto Start

    I just want the device to work on one for a minute and then the other.
    i already have a circuit which does all the tracking and movement of the motor, you see that circuit gets its input from 2 LDRs and then moves the motor in azimuth direction depending on where the sun is.

    Now what i want to do is, instead making a new circuit for the vertical direction, i want to make a timer circuit using PIC16F84A. So, now 2 inputs from the tracker circuit go into the PIC for timer circuit which is then connected to 4 LDRs as outputs (2 for vertical, 2 for azimuth). Two wires (negative, positive) for the motor control coming out from the tracker circuit go into the PIC for timer circuit as inputs, and at the output there will be 4 wires (2 wires for azimuth motor, 2 from vertical motor).

    Sooooo, for the first minute 2 LDRs for azimuth and motor for azimuth turns on, once thats done the trakcer circuit will do all the tracking and motor movement. After the 1 minute 2 LDRs for vertical and motor for vertical turns on... and then continues as a loop

    wowwwww thts looong, sorry for that, any help would be appreciated

    take care

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    What about this, if I am following you.
    All you want to do is turn on one circuit for a minute and then turn on another for a minute.
    The circuits are all ready built and working. I will assume they are separate and if power is applied they will run. Why do you want the LDRs connected to the timing PIC?

    Have the power of a tracking circuit driven by a relay or MOSFET/transistor.
    Now you have two pins as out puts from the timing PIC. One for each tracker.

    When a PIC pin is set either HIGH or LOW it will stay that way until it is changed.
    Try it with an LED.

    Code:
    START:
    HIGH PORT?.?  ' A Tracker POWER
    LOW PORT?.?  ' B Tracker POWER
    PAUSE 60000   
    LOW PORT?.?  ' A Tracker
    HIGH PORT?.?  ' B Tracker
    PAUSE 60000   
    GOTO START
    I know...I am missing something.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    I know...I am missing something.
    I think he wants to switch the circuit he has from 1 motor to the other so as not to buy / build another tracking circuit. It is doable but the issue I see is when switching from 1 set of sensors to another the calibration difference may throw things out of whack. I think all you need is a simple loop to switch a relay, something like:
    Code:
    loop:
    PortB.0 = 0
    pause 60000
    portb.0 = 1
    pause 60000
    goto loop
    EDIT: Another issue came to mind, and that is how your tracking circuit will react to having its outputs go from open circuit to loaded
    being switched by a relay, I am thinking some big resistors (high watt high ohm value) joining those circuits to handle the transients, or perhaps MOVs. Better yet use FETs to switch instead of relays . Damn I must be getting old . . .
    Last edited by Archangel; - 22nd March 2009 at 18: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.

  7. #7


    Did you find this post helpful? Yes | No

    Default

    WOWWWW guys, i didnt think this would be that complicated.

    Ok let me try to explain once more, u seeeee i already have the tracking circuit made, i got the 2 LDRs (FYI: these LDRs compare the light intensity and then move motor to a postion where there is equal light falling upon them) and the motor running at 12V, everything is setup, basically i have finished the tracking system for azimuth direction.

    All i want to do is thaaat instead of making a whole new tracking circuit for the vertical direction, i want to use an automatic timer. so now i should have one tracking circuit, 2 LDRs for azimuth direction, motor for moving panel in azimuth direction, 2 LDRs for vertical direction, and a motor for vertical direction. All the automatic timer should do is that to switch from one motor and a pair of LDRs (azimuth direction) to the other motor and a pair of LDRs (vertical direction).

    is there any project anywhere of this nature that i can refer to?

    Guys i seriously appreciate all the help u have provided, i mean believe it or not, this was my first time ever posting a message in a forum, and im really glad to see the kind of respose i have recieved.

    thanks once again, any furthur help would be appreciated,

    take care

  8. #8
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    OptimusPrime, All you need is a 4 pole double throw relay. 2 contacts for the motor output from the tracker to the motors and 2 contacts for the 2 sets of LDR's. Program the PIC for 60 second pause then toggle 1 of the outputs to drive a transistor to switch the relay... Pretty simple I think...

    Dave Purola,
    N8NTA

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. High Resolution Timer & Speed Calculator
    By WOZZY-2010 in forum Code Examples
    Replies: 4
    Last Post: - 7th February 2010, 16:45
  3. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 07:56
  4. Timer interrupt frequency
    By Samoele in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th January 2009, 23:49
  5. timer interupt help 16f73
    By EDWARD in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd July 2005, 08:41

Members who have read this thread : 1

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