Search:

Type: Posts; User: nenpa8lo

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    853

    In case of item/4 you get result 0 for item 0-3...

    In case of
    item/4 you get result 0 for item 0-3 and result 1 for item 4-7. In case of
    item%2 you get result 0 for item 0,2,4,6 and result 1 for item 1,3,5,7. Therefore final output is different...
  2. Replies
    2
    Views
    1,591

    scanf() did the job, thanks.

    scanf() did the job, thanks.
  3. Replies
    2
    Views
    1,591

    scanf() long input

    Hi,

    I'm expecting a very long input like up to 1000 values each as big as 1to100 (1 55 100 34 44 etc.). This is how I do it:

    char buffer[4 * 1000];
    char *ptr;
    char val;
    int i;

    scanf("%s",...
  4. Replies
    7
    Views
    1,573

    I'll go for an integer solution. Easy, reliable...

    I'll go for an integer solution. Easy, reliable and most likely faster.
  5. Replies
    7
    Views
    1,573

    Maybe I'll tell you what I want to do. I want to...

    Maybe I'll tell you what I want to do. I want to design a system return type. By that I mean a data type that would be used in the system (in some of the system functions). I came up with this...
  6. Replies
    7
    Views
    1,573

    Return 16bit structure or 16bit word?

    Which one is faster (and why). Returning structure:
    struct
    {
    unsigned char foo1;
    unsigned char foo2;
    } or returning unsigned int. Lets assume that they both take 16bits. Which one will be faster?
  7. Replies
    3
    Views
    1,428

    Ok I agree with what you said. I'm not...

    Ok I agree with what you said.



    I'm not sure about this one. In embedded you usually create cstartup file which is written in assembly and it has section that describe which part of SRAM data...
  8. Replies
    3
    Views
    1,428

    constant in function, what for?

    I recently met following statement:
    void func(void)
    {
    const unsigned char *const tab[]=
    {
    "Str1",
    "Str2",
    "Str3"
    };
    /* some code...
  9. Replies
    1
    Views
    5,967

    How to create IAR library

    Does anyone have an experience in creating own library in IAR environment? All I have is xlib.exe and it says that i should specify module to be a library by
    xlib m-l module_to_be_library.rnnwhere...
  10. Thread: Bit shift

    by nenpa8lo
    Replies
    8
    Views
    3,912

    Compiler is IAR for Embedded systems. From the...

    Compiler is IAR for Embedded systems.

    From the manual:

    The printf and sprintf functions use a common formatter called
    _formatted_write. The ANSI standard version of _formatted_write
    is very...
  11. Thread: Bit shift

    by nenpa8lo
    Replies
    8
    Views
    3,912

    so what's the real value of ShiftedBit? Bit...

    so what's the real value of ShiftedBit?

    Bit representation is:


    0x00008000 => 0000 0000 0000 0000 1000 0000 0000 0000So if I compare this then
    unsigned long int OtherBit = 1;
    unsigned long...
  12. Thread: Bit shift

    by nenpa8lo
    Replies
    8
    Views
    3,912

    I've found that 1

    I've found that 1 << 31 gives 'long' (-2147483648) instead of 'unsigned long'. Is that correct?
  13. Thread: Bit shift

    by nenpa8lo
    Replies
    8
    Views
    3,912

    Works now. Legend

    Works now. Legend
  14. Thread: Bit shift

    by nenpa8lo
    Replies
    8
    Views
    3,912

    Bit shift

    Hi,


    long unsigned int ShiftedBit = 0;

    ShiftedBit = 1 << 15;

    printf("%ld", ShiftedBit);Gives me a value of -32768. Code is written on 16 bit machine so unsigned int is 16bit and long...
  15. Replies
    6
    Views
    1,640

    See I tought that I can maybe mess around in...

    See I tought that I can maybe mess around in cstartup file. It has code to set whole stuff for OS. So if at the beginning of file I do in asm:
    org 0
    --define me 2B--
    then that would work? Don't...
  16. Simply main does not see 'ptr' and also it exists...

    Simply main does not see 'ptr' and also it exists only for while when test() is called.
  17. Replies
    6
    Views
    1,640

    constant's message

    Sorry, but I misstyped. I mean how can i force a compiler to build a value in ROM at address I want. I think that this must be done at compiling/linking stage. I need this to embedded system.
    ...
  18. Replies
    6
    Views
    1,640

    constant address

    Hi guys,

    Just wondering is it possible to force compiler to place a constant at some specific address?
  19. Thread: Iec 61508

    by nenpa8lo
    Replies
    1
    Views
    1,253

    Iec 61508

    Hi All,

    Do you know why software should have only one exit from any function regarding to IEC 61508? Because it takes long way/code to get out from very 'deep code' to the end of the function and...
  20. Thread: WORD Casting

    by nenpa8lo
    Replies
    8
    Views
    1,917

    And another one. WORD data; data = 0xE9E9;...

    And another one.
    WORD data;
    data = 0xE9E9;
    data >>= 8; is it always true that bits on the left hand side are '0' ? And in this case final value is 0x00E9? What if I want 3th byte from long (4B)? ...
  21. Thread: WORD Casting

    by nenpa8lo
    Replies
    8
    Views
    1,917

    So what you recommend for good coding practice?...

    So what you recommend for good coding practice? Which casting is better (safer, faster etc.)?
  22. Thread: WORD Casting

    by nenpa8lo
    Replies
    8
    Views
    1,917

    WORD Casting

    Hi All,

    Is there any difference?
    unsigned char data;
    unsigned int worddata;

    data = (unsigned char)worddata; and
    data = (unsigned char)(0x00FF & worddata);
  23. Replies
    10
    Views
    2,745

    Correct me if I'm wrong. When I do myfile.out

    Correct me if I'm wrong. When I do myfile.out < file.txt, file.txt is read in myfile.out as an keyboard, therefore I can not look for EOF. However I think that while(getc()) will work.
  24. Replies
    10
    Views
    2,745

    Simply in Linux you can use ReadDataFromKB.out...

    Simply in Linux you can use ReadDataFromKB.out < file.txt
    And I want to handle what ever is in the file.txt. Data must be process till NULL character.
  25. Replies
    10
    Views
    2,745

    input is STDIO (keyboard) :(

    input is STDIO (keyboard) :(
Results 1 to 25 of 42
Page 1 of 2 1 2