Jump to content

greddy

Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About greddy

  • Rank
    Newbrie
  1. Hey, I was wondering if there was an easy (short-hand) way to read/write the individual bytes of a long? (I tried things like long_value.0, or long_value[0], but they didn't work). I wrote these functions, but was hoping there was something more efficient: #define get_byte_3_of_long(long_byte_3, long_value) \ _asm movf _long_value+3, W \ _asm movwf _long_byte_3 #define get_byte_2_of_long(long_byte_2, long_value) \ _asm movf _long_value+2, W \ _asm movwf _long_byte_2 #define get_byte_1_of_long(long_byte_1, long_value) \ _asm movf _long_value+1, W \ _asm movwf _long_byte_1 #define get_byte_0_of_long(long_byte_0, long_value) \ _asm movf _long_value, W \ _asm movwf _long_byte_0 #define set_byte_3_of_long(long_byte_3, long_value) \ _asm movf _long_byte_3, W \ _asm movwf _long_value+3 #define set_byte_2_of_long(long_byte_2, long_value) \ _asm movf _long_byte_2, W \ _asm movwf _long_value+2 #define set_byte_1_of_long(long_byte_1, long_value) \ _asm movf _long_byte_1, W \ _asm movwf _long_value+1 #define set_byte_0_of_long(long_byte_0, long_value) \ _asm movf _long_byte_0, W \ _asm movwf _long_value Thanks, Greddy
×
×
  • Create New...