Search:

Type: Posts; User: nigelmercier

Page 1 of 2 1 2

Search: Search took 0.00 seconds.

  1. I've used the code I suggested, it seems to work....

    I've used the code I suggested, it seems to work. I have 27 bytes of ROM left!
  2. Thanks for the replies. A few points: The...

    Thanks for the replies. A few points:

    The "number" is always positive.

    I've already written the code to parse the NMEA string. It does it on the fly, extracting each field into a short string...
  3. Convert string to float without using library functions?

    First of all, this is not homework; I'm "fifty-eleven" :)

    I'm working on a microcontroller project and I need to convert a string (from a NMEA GPS receiver) into a float, I have very limited...
  4. Just a follow up, I had to use the code below,...

    Just a follow up, I had to use the code below, must be my compiler...



    bar = (float)(foo1) / (float)(foo2);
  5. Array of strings: access to each string?

    I've got a one dimensional array of strings (so actually a two dimensional array) declared as follows:



    // Global Constants (text)
    const char ErrTab[2][15] = {{"<WIRING SHORT>"}, {"<WIRING...
  6. Yup, you are right.

    Yup, you are right.
  7. Thank you, I thought I had tried that, but now it...

    Thank you, I thought I had tried that, but now it works. Weird!
  8. (Short) Integer Division into float variable

    I'm tearing my hair out (again). This time I will simplify:


    unsigned short foo1 = 31 ;
    unsigned short foo2 = 49 ;
    float bar ;
    bar = foo1/foo2 ; // I get zero. I want the result to be 0.633......
  9. Replies
    9
    Views
    727

    Although this needs to be: if (whatever) {...

    Although this needs to be:


    if (whatever)
    {
    foo(TSAft ...);
    }
    else
    {
    foo(TLFwd ... );
  10. Replies
    9
    Views
    727

    Hi Jim, I've looked into this and I really do...

    Hi Jim,

    I've looked into this and I really do need to set pointers to the arrays, for the sake of reducing code duplication. I assume this is still possible, although not necessary?
  11. Replies
    9
    Views
    727

    So no * or & prefixes? Or pointer declarations? ...

    So no * or & prefixes? Or pointer declarations?

    I had expected to have to set up some pointers before making the call in code common to both paths, but I guess I can have one call for each switch...
  12. Replies
    9
    Views
    727

    I've just cobbled together what I want to do as...

    I've just cobbled together what I want to do as far as passing the pointers is concerned, but I also need help with the other stuff ...


    while (1)
    { // infinite loop driven by interrupts
    ...
  13. Replies
    9
    Views
    727

    Help Needed with Pointers to Arrays

    I need some help with pointers, for some reason I can't get my head around them. I've got two pairs of arrays and associated values defined thus. Note "byte" is short integer, and yes you may have...
  14. Replies
    4
    Views
    2,399

    So you are suggesting I find the entries either...

    So you are suggesting I find the entries either side? I'm not sure how that would work. I could easily hard code it with a switch of course, but not very elegant.

    Other points:

    There are...
  15. Replies
    4
    Views
    2,399

    Find Nearest Value in Array?

    I'm building a water level gauge for my boat, so I'm writing code for a PIC microcontroller with an ADC port connected to a resistive sensor. The references below to getting single bytes is due to...
  16. Replies
    7
    Views
    828

    Yes, some time ago, and it got a bit messy. ...

    Yes, some time ago, and it got a bit messy.

    Compiler and IDE are mikroC PRO for PIC
  17. Replies
    7
    Views
    828

    Thanks, but I think I'm more confused now :)

    Thanks, but I think I'm more confused now :)
  18. Replies
    7
    Views
    828

    So more than one .h file then? I think I need a...

    So more than one .h file then? I think I need a book.
  19. Replies
    7
    Views
    828

    C Style Guide?

    All the books I have read on C seem to lump everything into a single file, I guess this is because they are relatively short examples. Is there a C Style Guide somewhere that can advise with the...
  20. Replies
    18
    Views
    2,891

    All sorted, see here...

    All sorted, see here
  21. Replies
    18
    Views
    2,891

    It's the same as the sample I gave at the start...

    It's the same as the sample I gave at the start of the thread:


    const char FONTTABLE[96][5]=
    {
    {0x00,0x00,0x00,0x00,0x00},
    {0x00,0x00,0x5f,0x00,0x00},
    {0x00,0x07,0x00,0x07,0x00},
    /**...
  22. Replies
    18
    Views
    2,891

    Oh dear, I thought I was winning for a moment....

    Oh dear, I thought I was winning for a moment. Here is my equivalent code:




    void charLcd(unsigned char character) // Send any # of bytes to LCD
    {
    int tablept; // pointer in table - i in...
  23. Replies
    18
    Views
    2,891

    What I meant was, do I have to pass the size, or...

    What I meant was, do I have to pass the size, or can I find in in the called function?
  24. Replies
    18
    Views
    2,891

    Thanks, but I didn't understand this bit: ...

    Thanks, but I didn't understand this bit:



    void print(const char *data, size_t size) {
    size_t x;


    It seems to have a type size_t - is that right?
  25. Replies
    18
    Views
    2,891

    OK, lets say I've calculated elsewhere that I...

    OK, lets say I've calculated elsewhere that I need the data in row i. Now I want to pass this row (a one-dimensional array) to another function. In this function I need to (say) iterate through the...
Results 1 to 25 of 27
Page 1 of 2 1 2