HardWare/PIC322 PIC32 Float <-> Byte[] 함수 UINT8 byte_array[4]; float f = 24234.0f; //some value memcpy( byte_array, &f, sizeof(f) ); UINT8 byte_array[4] = {0x00,0x54,0xbd,0x46}; float *fp=(float*)(&byte_array); float f2=*fp; 2011. 8. 22. PIC32 Delay 함수 #define FALSE 0 #define TRUE !FALSE #define FCY 72000000L #define FPB 36000000L #define WIDTH 1; #define REFRESH 20; #pragma config FPLLMUL = MUL_20, FPLLIDIV = DIV_2, FPLLODIV = DIV_1, FWDTEN = OFF #pragma config POSCMOD = HS, FNOSC = PRIPLL, FPBDIV = DIV_1 #define SYS_FREQ (80000000L) void Delayus( unsigned t) { T1CON = 0x8000; // enable TMR1, Tpb, 1:1 while (t--) { TMR1 = 0; while (TMR1 < FPB.. 2011. 7. 11. 이전 1 다음