solar tracker controller


Closed Thread
Results 1 to 40 of 42

Hybrid View

  1. #1
    Join Date
    Mar 2011
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: solar tracker controller

    v1 var byte 'variable v1
    v2 var byte 'variable v2
    v3 var byte 'variable v3

    TRISA = 1 'Set all PORTA pins as inputs (Cds)
    TRISB = 1 'Set all PORTB pins as outputs (limit switch)
    TRISC = 0 'Set all PORTC pins as outputs (motor)

    start:
    pot porta.0,255,v1 'Read 1st CdS Sensor (east)
    pot porta.1,255,v2 'Read 2nd CdS Sensor (west)

    if v1 <= 230 then skp 'start program
    if v2 > 230 then slp 'is it dark enough to sleep? (sleep mode)

    skp:
    if v1 = v2 then start 'If equal, do nothing
    if v1 > v2 then greater 'If greater, check how much greater
    if v1 < v2 then lesser 'If lesser, check how much lesser

    if PORTB.1 = 0 then face_east 'limit switch1
    if PORTB.2 = 0 then hold 'limit switch2

    greater: 'greater routine
    v3 = v1 - v2 'find the difference
    if v3 > 10 then cw 'is it within the range? if not go to clockwise/ solar panel facing west
    low PORTC.0 'pin portb.0 low /stopping the solar panel for moving
    low PORTC.1 'pin portb.1 low / stopping the solar panel for moving
    goto start 'if it is in the range,do it again

    lesser: 'lesser routine
    v3 = v2 - v1 'find the difference
    if v3 > 10 then ccw 'is it within the range? if not got counter clockwise/solar panel facing east
    low PORTC.0 'pin portb.0 low /stopping the solar panel for moving
    low PORTC.1 'pin portb.1 low / stopping the solar panel for moving
    goto start 'if it is in the range, do it again

    slp:
    low PORTC.0 'stopping the solar tracker for moving
    low PORTC.1 'stopping the solar tracker for moving
    sleep 1800 'sleep the system for half an hour
    goto start

    cw: 'Turn the sensor array clockwise
    high PORTC.0 'Turn on h-bridge
    pause 100 'Let it turn for a moment
    goto start 'Check again

    ccw: 'Turn the sensor array counter clockwise
    high PORTC.1 'Turn on h-bridge
    pause 100 'Let it turn a moment
    goto start 'Check again

    face_east: 'facing east
    low PORTC.0 'pin portb.0 low /stopping the solar panel for moving
    low PORTC.1 'pin portb.1 low / stopping the solar panel for moving
    sleep 14400 'wait for 4 hours
    high PORTC.1 'pin portb.1 high /solar panel back facing east ready for next day sun shine
    pause 1000 'wait for 1 sec
    goto start 'check again

    hold:
    low PORTC.0 'pin portb,0 low / stopping the parabolic for moving
    low PORTC.1 'pin portb.1 low /
    sleep 3600 'wait for 1 hour
    goto start
    end



    WHY THIS PROGRAMMING CANNOT BE COMPILE....
    WARNING - THE MICROCHIP ASSEMBLER (MPASM)ONLY ALLOW 62 CHARACTER TO BE USED FOR PATH AND FILE NAME. CURRENT LENGTH IS 68 CHARACTERS....

    I DONT UNDERSTAND..... PLEASE ANYONE EXPLAIN TO ME....?

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


    Did you find this post helpful? Yes | No

    Default Re: solar tracker controller

    Maybe you have not noticed but you CAPs lock seems to be stuck on.

    The waring message means exactly what it says.
    Move you project directory closer to the root of the drive so there are less than 62 characters between "C" and the end of your file name.
    C:\myProject\xxx.bas
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Microstepper controller
    By aratti in forum Schematics
    Replies: 14
    Last Post: - 3rd January 2015, 16:52
  2. Replies: 14
    Last Post: - 6th March 2011, 05:08
  3. Replies: 2
    Last Post: - 14th July 2008, 22:11
  4. Fridge controller
    By nomad in forum General
    Replies: 4
    Last Post: - 23rd February 2008, 07:13
  5. Dedicated LCD Controller question
    By chuckles in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th February 2006, 14:44

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