سلام و خسته نباشید به تمام دوستان و مهندسان یک مشکل برای من پیش اومده که اگر کمک کنیید متشکر می شوم اونم اینه که برای یک پروژه یکی به من راه حلی برای ارسال اطلاعات پیشنهاد کردش اونم ارسال به روش ieeefloating point to decimal حالا یک چیزی پیداکردم که به زبان اسمبلی حالا می خوام اینو یک نفر محبت کنه به c تبدیل کنه که بتونم اینو تو کامپیوتر با زبان C# بنویسمش متشکر می شوم اگر کمکم کنید
float f_IEEEtoPIC(int32 f)
{
float * ret;
#locate f=0x20
ret = &f;
#asm
// swap the outer bytes
movf 0x20,W
xorwf 0x23,W
xorwf 0x23,F
xorwf 0x23,W
movwf 0x20
// swap the inner bytes
movf 0x21,W
xorwf 0x22,W
xorwf 0x22,F
xorwf 0x22,W
movwf 0x21
#endasm
#if defined(__PCB__) || defined(__PCM__)
#asm
// switch the bits
rlf 0x21
rlf 0x20
rrf 0x21
#endasm
#elif defined(__PCH__)
#asm
// switch the bits
rlcf 0x21
rlcf 0x20
rrcf 0x21
#endasm
#else
#error Invalid complier defined
#endif
return *ret;
}
float f_IEEEtoPIC(int32 f)
{
float * ret;
#locate f=0x20
ret = &f;
#asm
// swap the outer bytes
movf 0x20,W
xorwf 0x23,W
xorwf 0x23,F
xorwf 0x23,W
movwf 0x20
// swap the inner bytes
movf 0x21,W
xorwf 0x22,W
xorwf 0x22,F
xorwf 0x22,W
movwf 0x21
#endasm
#if defined(__PCB__) || defined(__PCM__)
#asm
// switch the bits
rlf 0x21
rlf 0x20
rrf 0x21
#endasm
#elif defined(__PCH__)
#asm
// switch the bits
rlcf 0x21
rlcf 0x20
rrcf 0x21
#endasm
#else
#error Invalid complier defined
#endif
return *ret;
}
دیدگاه