Skip to main content
Commonmark migration
Source Link

I'm using Xc8 compiler and pic18f.Im communicating with a dspic30f ;coded in assembly and receiving a 4 byte variable via i2c.

Task: I have to receive the 4 byte packet store,modify it and send back to the dspic controller. Since I'm using xc8 compiler,I trust I can store the packet as float only which consumes 3 or 4 bytes of space.But the compiler converts the 3-4 bytes in to IEEE float format of which I have only limited understanding.

 

Eg:If dspic sends a 4 byte value 0x0001ffff and expects pic 18f to modify and send the value as 0x001f00ff. As the pic18 used xc8 compiler;I trust the only way is to store the 4 bytes as float.But I have no idea how to resend the modified float value in to the desired hexadecimal format?.

I would appreciate any valuable inputs or suggestions.Meanwhile I'll give an attempt to understand the float format in C compilers. Any alternatives that can possibly make this happen will be deeply appreciated.

Thank you for your time.

Regards

Rookie91

I'm using Xc8 compiler and pic18f.Im communicating with a dspic30f ;coded in assembly and receiving a 4 byte variable via i2c.

Task: I have to receive the 4 byte packet store,modify it and send back to the dspic controller. Since I'm using xc8 compiler,I trust I can store the packet as float only which consumes 3 or 4 bytes of space.But the compiler converts the 3-4 bytes in to IEEE float format of which I have only limited understanding.

 

Eg:If dspic sends a 4 byte value 0x0001ffff and expects pic 18f to modify and send the value as 0x001f00ff. As the pic18 used xc8 compiler;I trust the only way is to store the 4 bytes as float.But I have no idea how to resend the modified float value in to the desired hexadecimal format?.

I would appreciate any valuable inputs or suggestions.Meanwhile I'll give an attempt to understand the float format in C compilers. Any alternatives that can possibly make this happen will be deeply appreciated.

Thank you for your time.

Regards

Rookie91

I'm using Xc8 compiler and pic18f.Im communicating with a dspic30f ;coded in assembly and receiving a 4 byte variable via i2c.

Task: I have to receive the 4 byte packet store,modify it and send back to the dspic controller. Since I'm using xc8 compiler,I trust I can store the packet as float only which consumes 3 or 4 bytes of space.But the compiler converts the 3-4 bytes in to IEEE float format of which I have only limited understanding.

Eg:If dspic sends a 4 byte value 0x0001ffff and expects pic 18f to modify and send the value as 0x001f00ff. As the pic18 used xc8 compiler;I trust the only way is to store the 4 bytes as float.But I have no idea how to resend the modified float value in to the desired hexadecimal format?.

I would appreciate any valuable inputs or suggestions.Meanwhile I'll give an attempt to understand the float format in C compilers. Any alternatives that can possibly make this happen will be deeply appreciated.

Thank you for your time.

Regards

Rookie91

Source Link
Rookie91
  • 2.1k
  • 5
  • 30
  • 48

How to store modify and resend 4 bytes of data from an assembly coded dspic to that in a c compiler based pic18f

I'm using Xc8 compiler and pic18f.Im communicating with a dspic30f ;coded in assembly and receiving a 4 byte variable via i2c.

Task: I have to receive the 4 byte packet store,modify it and send back to the dspic controller. Since I'm using xc8 compiler,I trust I can store the packet as float only which consumes 3 or 4 bytes of space.But the compiler converts the 3-4 bytes in to IEEE float format of which I have only limited understanding.

Eg:If dspic sends a 4 byte value 0x0001ffff and expects pic 18f to modify and send the value as 0x001f00ff. As the pic18 used xc8 compiler;I trust the only way is to store the 4 bytes as float.But I have no idea how to resend the modified float value in to the desired hexadecimal format?.

I would appreciate any valuable inputs or suggestions.Meanwhile I'll give an attempt to understand the float format in C compilers. Any alternatives that can possibly make this happen will be deeply appreciated.

Thank you for your time.

Regards

Rookie91