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
    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.

  2. mrmeval

    AAC Fanatic!

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

    AAC Fanatic!

    Oct 14, 2005
    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.