Menu

Long format memory info

Help
2012-10-17
2013-05-30
  • Edward LaBudde

    Edward LaBudde - 2012-10-17

    Hugh, can you shed some light in the memory locations for Long variables?   I now see _h, _u, _e added to variable names.  Can you tell me how to read these and calculate the number that is calculated?  Thanks, Ed.

     
  • joe rocci

    joe rocci - 2012-10-17

    Ed

    Assume a Long variable named "myLong".

    If you read  "myLong" (without any underscored extension) into a Byte variable, you will get the lowest byte (byte 0) of the Long. "myLong_H" references byte 1, "myLong_U" references byte 2 and "myLong_E" references byte 3.

    Each successive byte has a weight that is 2^8 (256) times the previous byte. For example, the Long with a decimal value of 67,305,985 would have the following bytes:

    Byte 0 = 1
    Byte 1 ("_H") = 2
    Byte 2 ("_U") =  3
    Byte 3 ("_E")  = 4

    (4 * 2^24) + (3 * 2^16) + (2 * 2^8) + (1 * 2^0) = 67,305,985

    I've been using Longs in one of my applications and they seem to work well math-wise. However, I don't think there is full support for non-math references.

    Joe

     
  • Edward LaBudde

    Edward LaBudde - 2012-10-17

    Joe, Great thanks, Ed.

     
  • Nobody/Anonymous

    Hi,

    I just started using Longs last week. (I only found out they were available quite by chance). They work great and really simplified my current project. It's interesting to note that the PicBasic Pro compiler can only do Longs for 18F chips. So save some money and use Great Cow! (I'm using them on a 16F88).

    What we need now to makes things even simpler is to make them work with the EEPROM read and write commands. I just broke them up into bytes and stored them that way.

    Thomas Henry

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.