Search:

Type: Posts; User: sonnichs

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    5
    Views
    765

    Thanks for your prompt response John. I am...

    Thanks for your prompt response John. I am working on PIC18s with the xc compiler which are little-endian. Darn-I have had my share of reversing bytes before!
    Your construct makes sense. I don't...
  2. Replies
    5
    Views
    765

    casting 4 chars to long int

    I am trying to move a 4 byte char buffer into a 32bit integer. No conversion--just move it.
    I have the stretch of code below:
    ==========================================
    char buff[4];
    buff[0] =...
  3. Sorry for the delay here-I spent most of...

    Sorry for the delay here-I spent most of yesterday dealing with an errant 3D printer. At any rate I was trying save you having you look at my code using pseudo code but it lead to confusion and I...
  4. Determining operator at run time efficiently (without "if')

    I have the stretch of pseudocode below. We have a very long running loop and the code needs to be highly efficient. We need to run the function using either "<" or ">" depending upon circumstances...
  5. Replies
    5
    Views
    3,342

    Thank you Salem----watching with top is a good...

    Thank you Salem----watching with top is a good idea--I will do that once I get this all running
    cheers
    fritz
  6. Replies
    5
    Views
    3,342

    Salem- I should have added, that the ancillary...

    Salem- I should have added, that the ancillary tasks run quickly, opening the serial port and finishing well before the main task shuts down the power supply and sleeps.
    I tried "system" and it...
  7. Replies
    5
    Views
    3,342

    Starting Programs from a C program in Linux

    I have a C program running on Ubuntu that starts up a power supply for a period of time and then stops it. During this period I need to start some ancillary programs on the same linux machine that...
  8. Thanks for the reply. I have done it this way in...

    Thanks for the reply. I have done it this way in the past and I guess its easier to understand (for me) rather than the type casting methods which seem prevalent in a lot of vendor code. Ultimately...
  9. typecasting and passing variable sized parameters to a subroutine

    I am dealing with an ADC that requires from 1 to 4 byte register writes to set its parameters. I want just one routine (not 4) to handle all cases. So I have 1 to 4 byte register updates cast as a...
  10. Replies
    3
    Views
    372

    OK and thanks for the offer! Regarding...

    OK and thanks for the offer!

    Regarding padding-I guess the answer you pose is that C will try to preserve the numerical value of what is being cast to a larger bit pattern. (I am big endian here)....
  11. Thanks for the good question Salem. I...

    Thanks for the good question Salem.

    I am configuring an Analog Devices AD7793 converter. It has various length registers that must be written, from 1 to 4 bytes. So I want just one generic...
  12. Replies
    3
    Views
    372

    typecast and padding

    Is there an "official" document somewhere that describes a standard for padding during typecasting.For example I am using:

    uint16_t var1 = 0xEEFF;
    uint32_t var2;

    then
    var2 = (uint32_t)var1;...
  13. OK. The (uint8_t*) typecast worked. I...

    OK.
    The (uint8_t*) typecast worked.
    I had been doing it wrong with (uint8_t) but now I understand.

    So-your explanations of the reasons for datatyping an address make sense.

    thanks for...
  14. passing variable sized parameters to a subroutine

    I am trying to write a subroutine that can accept variables of 1,2 or 4 bytes, e.g the variables to be passed can be type uint8_t,uint16_t and uint32_t.

    The prototype is:
    int ADC( uint8_t...
  15. Replies
    19
    Views
    6,046

    "magically be transformed to a negative number"...

    "magically be transformed to a negative number"
    Yuk-now I remember while I used to have the patience to suffer with assembler!
  16. Replies
    19
    Views
    6,046

    Hmmmm-the reason I did not want to use unsigned...

    Hmmmm-the reason I did not want to use unsigned was because the serial port routines on this processor complain about it. However, when I set my long int to X'11FFFFFFFF', the result in the buffer is...
  17. Replies
    19
    Views
    6,046

    Thanks grumpy and sorry about the conversion...

    Thanks grumpy and sorry about the conversion error for 6844.

    My long int is always under 65x10^6 (e.g. less than 80000000) so I assume I don't need to worry about signs.

    I settled on a...
  18. Replies
    19
    Views
    6,046

    One thing that I didnt' mention is that the...

    One thing that I didnt' mention is that the receiving machine is a spectrometer-I don't have access to its code etc. The compiler/microprocessor that I am using does not support htonxx() routines.
    ...
  19. Replies
    19
    Views
    6,046

    Thanks for the replies. I gained my expertise...

    Thanks for the replies. I gained my expertise (now long gone!) on Univacs, 370s and Solaris. I am pretty sure these were big-endian. I will play it safe and not rely on an given byte order as my code...
  20. Replies
    19
    Views
    6,046

    long integers and byte order

    I was preparing to send some bits down a serial port and I did a very simple thing. The bits were defined in a long int like this: long int lngint=19114957L;
    The hex representation of this...
  21. Replies
    17
    Views
    22,425

    "The actual representation of an int as a decimal...

    "The actual representation of an int as a decimal or hex, is just the graphical representation of that binary format"

    I really like that way of expressing it!

    I used to write mostly in...
  22. Replies
    17
    Views
    22,425

    Ah-didn't know about the code rule-sorry. ...

    Ah-didn't know about the code rule-sorry.

    Thanks for the answer-works fine! I wouldn't have thought of using a "print" command to convert data but if the shore fits---------

    Cheers
    Fritz
  23. Replies
    17
    Views
    22,425

    need function to convert int to hex

    I am loading some integers and long integers into a string as hexidecimal. For example:

    int I 1234;
    str char[2];
    Then funct(I) returns:
    str[0]=0x04 and str[1]=0xD2

    I have written the...
  24. Replies
    17
    Views
    2,360

    Aha. Thanks! The compiler seems to like that....

    Aha. Thanks!

    The compiler seems to like that. I can use i = atoi(mat[2]+5); to get the four bytes starting at 5 from record #2.
    Interestingly the compiler did not like mat + 2 x row-length...
  25. Replies
    17
    Views
    2,360

    OK-your C99 comments are well taken. I learned C...

    OK-your C99 comments are well taken. I learned C in the 1970's. I am always terrified of "standards" becuase in the computer field, every vendor seems to invent their own and I am never sure if a...
Results 1 to 25 of 28
Page 1 of 2 1 2