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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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
Joe, Great thanks, Ed.
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