Jump to content

pushkar

EstablishedMember
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

0 Neutral

About pushkar

  • Rank
    Newbrie
  1. Hi, I try to use a function pointer with a typedef definition. My code seems to be good in ANSI C but don't compile with BoostC. This is my code : typedef void (*TOTO)(unsigned char); TOTO MySuperFunc; void MyFunc(unsigned char del){ delay_ms(del); } void main(){ MySuperFunc = MyFunc; MySuperFunc(100); } Can I use 'typedef' with the function pointer ? Thank you for your help.
  2. Hi, I think there is a problem in your code, when you write : delay_ms( 10000 ); // pause 10.0 seconds because the delay_ms have a 'unsigned char' parameter (8 bits). Your real delay with this call is probabely 16 ms (10000 = 0x2710 > then only 0x10 for you > 16 ms). The same with your 'delay_ms(500)'.... I think you must write : delay_s( 10 ); // pause 10.0 seconds and delay_ms( 250 ); // pause 250 milliseconds delay_ms( 250 ); // pause 250 milliseconds but I can be wrong....
  3. Hi, I use a 18F2523. I have a debugger problem when I try to read and write the internal PIC eeprom. This is my code (from lika.be) : char eeprom_read(char address){ // Load address eeadr = address; // Point to EEPROM memory eecon1.EEPGD = 0; // 18F devices also need the CFGS bit to be cleared eecon1.CFGS = 0; // Read, data is available in eedata the next cycle. eecon1.RD = 1; // Return value return eedata; } void eeprom_write(char address, char data){ // 18F devices also need the CFGS bit to be cleared eecon1.CFGS = 0; // Wait for write to complete while (test_bit(eecon1, WR)){}; // Load address and data eeadr = address; eedata = data; // Point to EEPROM memory eecon1.EEPGD = 0; // Write enable set_bit(eecon1, WREN); // Disable interrupts clear_bit(intcon, GIE); // Required write sequence eecon2 = 0x55; eecon2 = 0xAA; set_bit(eecon1, WR); // Disable write clear_bit(eecon1, WREN); // Enable interrupts set_bit(intcon, GIE); } void main() { char t; eeprom_write(100,55); eeprom_write(101,22); eeprom_write(102,243); t = eeprom_read(100); t = eeprom_read(101); t = eeprom_read(102); } The sourceboost debugger seems to not work properly. The toggle EEPROM bar never move (always 0xFF) and my variable (t) is always 243 (last edata write)..... Could you help me ? Thank you.
  4. Yes, I understand your logic, if PIC don't have float hardware capabilities, compiler don't have too. But 'float' is a data type and I have some problem to use it with the floating point library. I don't know if the problem is boostc or other but, for example, I can't use float with pointers. I have structures arrays with some floats in my program and boostc return an error. Then, 'include floats in boostc' is just a sugestion. I like boostc and it's the better PIC compiler for me.... Thank you for your responses.
  5. Yes, floating point library is very good but some compiler like CCS or HiTec have a 'native' float type and don't need a external library. That seems that you can write 'a = b + c'. I think it would be great if boostc can do the same....no ?
  6. Hi, Is it possible to integrate the float library in boostc and boostc++ ? It's more simple to write : float a; float b; float c; a = a + (b * c) even : b = float32_mul(b,c); a = float32_add(a,; Thank you.
  7. I have another small example. Float point lib seems to not work with pointers (boostc problem ?). #include <system.h> #include <float.h> void my_test(float * k) { *k = float32_add(*k,3.52); } void main() { float t; t = 10.1; my_test(&t); } Thank you...
  8. Hi, I have a little problem with the floating point library and pointers. I use a structure with some floats : typedef struct { float t1; float t2; } TEST; TEST t[2]; void my_test(TEST * k) { k->t1 = float32_add(k->t1,k->t2); } void main { my_test(&(t[0])); } The boostc compiler make this error to the 'float32_add' function : error: failed to generate expression error: arguments of 'float32_addsub' don't match the parameters of call I have try to cast the parameters but there is no effect.... Could you help me ? Thank you.
×
×
  • Create New...