writing a long int variable to eeprom

Discussion in 'Embedded Systems and Microcontrollers' started by raidermanz, Aug 23, 2007.

  1. raidermanz

    Thread Starter Active Member

    Aug 14, 2007
    32
    0
    I am trying to write a float (int32) variable in whole number format (No decimals) into a memory location. I am using a PIC 16F877A. My number keeps getting truncated to the remainder from 255. I understand this will only allow me to write an 8 bit integer to memory, but any suggestions on how to manipulate the data to get around this problem. I am new to this world, so please go easy on me. I don't understand assembler code, I am working from a C compiler, so any remedial help will be appreciated.

    Thanks
     
  2. mrmeval

    Distinguished Member

    Jun 30, 2006
    833
    2
    Have you tried declaring the variable as float?
     
  3. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    4
    Save the least significant 8 bits first, shift to the right 8 times, and do this four times. To read just reverse the above process.
     
Loading...