Calculating Sunrise and Sunset 2


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    970


    Did you find this post helpful? Yes | No

    Default Re: Calculating Sunrise and Sunset 2

    I have done this in C many years back. However, you need to use double precision floating point numbers to get accurate results. PicBasic code? I doubt it as Picbasic does not support this data type.

  2. #2
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    946


    Did you find this post helpful? Yes | No

    Default Calculating Sunrise and Sunset 2

    Yes, this is what I found out too.

    Is there any chip that would do this math for me I could embed in my circuit, at least as a plan B?
    Roger

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Calculating Sunrise and Sunset 2

    I don't know how to calculate it but do you really have to? I mean, do you have to calculate it on the PIC, at runtime? It's not like your wall clock is changing location on a day to day basis, is it?

    You could calculate it (or simply look it up) on your PC, store the results in your PBP program and look it up at runtime. If calculating it is "heavy" then a pre-calculated table is probably smaller in size and definetly faster.

  4. #4
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    946


    Did you find this post helpful? Yes | No

    Default Calculating Sunrise and Sunset 2

    Henrik,

    Right, no need for runtime data.

    Any idea where a kind of data table would be to be found?
    Roger

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default Re: Calculating Sunrise and Sunset 2

    I think it is best to be calculated in a Excel file and then the results stored in an External EEPROM?

    Ioannis

  6. #6
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Calculating Sunrise and Sunset 2

    You can store lot of data in program memory. And get it with read code.

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Calculating Sunrise and Sunset 2

    Henrik,

    Right, no need for runtime data.

    Any idea where a kind of data table would be to be found?
    Let me Google that for you....
    https://www.timeanddate.com/sun/swed...h=10&year=2024

    It defaulted to Gothenburg for me so obviously you'll need to change that.

Similar Threads

  1. Calculating MKT
    By pedja089 in forum General
    Replies: 1
    Last Post: - 10th November 2013, 15:46
  2. Calculating a checksum
    By simongie in forum General
    Replies: 4
    Last Post: - 21st August 2009, 14:08
  3. Calculating Sunrise and Sunset
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st November 2007, 17:56
  4. calculating speed of a loop
    By EDWARD in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th June 2005, 21:34
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 29th November 2004, 00:56

Members who have read this thread : 3

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