Unable to fit variable


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Still a newbe

    And not having my PBP manual handy, do those declares try and allocate 8 arrays , 250 elements big? so 2k just for the vars?
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  2. #2
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    yep ok put this at ten and it now compile error free. Thanks for the cue really appreciate it.

    But with ten elements:
    Voltage_Charge_time_RTCSec var byte[10]
    does that mean I can have only ten values? like:
    Voltage_Charge_time_RTCSec var byte[0]
    Voltage_Charge_time_RTCSec var byte[1].....
    ......
    Voltage_Charge_time_RTCSec var byte[9]
    Voltage_Charge_time_RTCSec var byte[10] ?????

    Ken

  3. #3
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    yep ok put this at ten and it now compile error free. Thanks for the cue really appreciate it.

    But with ten elements:
    Voltage_Charge_time_RTCSec var byte[10]
    does that mean I can have only ten values? like:
    Voltage_Charge_time_RTCSec var byte[0]
    Voltage_Charge_time_RTCSec var byte[1].....
    ......
    Voltage_Charge_time_RTCSec var byte[9]
    Voltage_Charge_time_RTCSec var byte[10] ?????

    Ken
    yes thats what it means, except it will go from 0 - 9, not 0 - 10. 0 - 10 is 11 elements. What are you trying to save here? sec and min should never need to be over 60 hours would never need to exceed 12 or 24 days would never need to be more than 31 add months for up to 12. but I may very well be thinking a whole different thing.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  4. #4
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Humm yes I understand what you mean.
    Here is what i am attempting to do, for sure there is anothr way to do it much better then the one I am thinking. My battery will be charging and discharging automatically for an indefinit period of time. Lets say the longest would a month !! So there could be lets say 5 charge /discharge cycle a day..so 150 total. SO for the seconds I would have something like that:
    Voltage_Charge_time_RTCSec var byte[0] = First charge cycle time (ie. 02 seconds)
    Voltage_Charge_time_RTCSec var byte[1] = Second charge cycle time (ie. 42 seconds)
    etc...
    How can I keep the time for 150 cycles ?

    K
    Last edited by lerameur; - 25th November 2010 at 15:53.

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


    Did you find this post helpful? Yes | No

    Default

    How can I keep the time for 150 cycles ?
    Write to the EEPROM?
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Guess thats a good idea. I will go ahead and read up on EEPROM in the F88.pdf meanwhhile if you have a tutorial of something interesting to read on programming to the EEPROM with pic basic, that will be very appreciate . I never programmed to the EEPROM before !!

    k

  7. #7
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Hi I can find a lot of stuff with external EEPROM, if I need to program the internal EEPROM, do I need to use wires to itself ? I have not seen any examples either !! so far

    K

  8. #8
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default

    Hello,

    The 16F877A has 368 bytes of RAM so trying to fit 8 arrays each 250 bytes long is simply impossible.

    On top of that, on 16F devices, the RAM is divided into banks (which PBP mostly handle transparantly for you) and each array has to fit in one RAM bank. Each bank is 128 bytes but the lower 32bytes of each bank is occupied by the special function registers (TMR0, INTCON, TXREG etc) so only the upper 96 bytes of each bank is available for "user RAM". So the longest array you can declare on a 16F device is 96 bytes.

    Not all banks will have the top 96 bytes available either, see the memory organization chapter in the datasheet for the particualr PIC details and the section about arrays in the PBP manual for more details.

    /Henrik.

    EDIT: Ah, was a little slow typing there. Anyway, hopefully the information will help.

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