This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

gsm sim 900

i have one doubt, how to send array value via gsm.

Parents
  • Now your keyboard caps-lock has failed again. You really should go get a new keyboard - "screaming" on forums isn't the best way to get help...

    How to send an integer? If you have a channel that doesn't support a binary transfer, then you need to encode the integer. This forum can't handle binary data but I can still send the integer 12345 to you. I just follow the normal encoding conventions on web forums and send it as the ASCII characters '1', '2', '3', '4', '5' after each other. Note that the language have ways of converting between ASCII digits and integer numbers on both directions. And it's also quite simple to "manually" perform the conversion using simple C code. 4103 is 4*1000 + 1*100 + 0*10 + 3*1.
    Or in the other direction:
    4103/10000 = 0.
    4103 - 0*10000 = 4103
    4103/1000 = 4
    4103 - 4*1000 = 103
    103/100 = 1
    103 - 1*100 = 3
    3/10 = 0
    3 - 0*10 = 3
    3/1 = 3
    3 - 3*1 = 0
    Ignore the initial zero and the above got you 4, 1, 0, 3 which forms the decimal number 4103.

    Your delay really is quite interesting - programming is the hobby of how to create complex functionality out of simpler primitives. All the way down to the language primitives of the compiler/assembler.

    Doing:

    delay(1000);delay(1000);delay(1000);delay(1000);
    


    seems pretty silly when it's much easier to do:

    delay(4000);
    

    Next thing - it's way better to try to create a delay primitive that has some recognizeable physical property and then reuse it for longer delays. With some physical unit, it's way easier for a reader to understand how long the delay is expected to be.

    If you have a function delay_one_ms() then you can implement:

    void delay_milliseconds(unsigned ms) {
        while (ms) {
            --ms;
            delay_one_ms();
        }
    }
    
    void delay_seconds(unsigned s) {
        while (s) {
            --s;
            delay_milliseconds(1000);
        }
    }
    
    void delay_hours(unsigned h) {
        while (h) {
            --h;
            delay_seconds(3600);
        }
    }
    
    void delay_days(unsigned d) {
        while (d) {
            --d;
            delay_hours(24);
        }
    }
    

    Suddenly, you can with a single call delay_days(65535u) on a 16-bit processor create a delay of more than 179 years - longer than the longest human life. So why have a huge number of delay() calls after each other?

    Note of course that a busy-loop delay that just counts clock cycles will give too long delays in more complex designs where the processor may allocate clock cycles to other things - like interrupt processing. That's why it's best to only create very short "at least" delays using busy-loop delays and make use of timers or other hardware to create longer delays with good precision.

    I think you need to figure out what you want. You want to learn how to program? Then you can't give up and demand solutions from other people whenever you get stuck. You have to be willing to invest whatever time it takes to learn. As you learn, you'll notice that what you originally thought of as hard is actually quite simple. Just as it's extremely hard to implement walking robots but we humans manages quite well after a bit of training. There is no shortcut to avoid the need for training - you really do need to invest own time!

Reply
  • Now your keyboard caps-lock has failed again. You really should go get a new keyboard - "screaming" on forums isn't the best way to get help...

    How to send an integer? If you have a channel that doesn't support a binary transfer, then you need to encode the integer. This forum can't handle binary data but I can still send the integer 12345 to you. I just follow the normal encoding conventions on web forums and send it as the ASCII characters '1', '2', '3', '4', '5' after each other. Note that the language have ways of converting between ASCII digits and integer numbers on both directions. And it's also quite simple to "manually" perform the conversion using simple C code. 4103 is 4*1000 + 1*100 + 0*10 + 3*1.
    Or in the other direction:
    4103/10000 = 0.
    4103 - 0*10000 = 4103
    4103/1000 = 4
    4103 - 4*1000 = 103
    103/100 = 1
    103 - 1*100 = 3
    3/10 = 0
    3 - 0*10 = 3
    3/1 = 3
    3 - 3*1 = 0
    Ignore the initial zero and the above got you 4, 1, 0, 3 which forms the decimal number 4103.

    Your delay really is quite interesting - programming is the hobby of how to create complex functionality out of simpler primitives. All the way down to the language primitives of the compiler/assembler.

    Doing:

    delay(1000);delay(1000);delay(1000);delay(1000);
    


    seems pretty silly when it's much easier to do:

    delay(4000);
    

    Next thing - it's way better to try to create a delay primitive that has some recognizeable physical property and then reuse it for longer delays. With some physical unit, it's way easier for a reader to understand how long the delay is expected to be.

    If you have a function delay_one_ms() then you can implement:

    void delay_milliseconds(unsigned ms) {
        while (ms) {
            --ms;
            delay_one_ms();
        }
    }
    
    void delay_seconds(unsigned s) {
        while (s) {
            --s;
            delay_milliseconds(1000);
        }
    }
    
    void delay_hours(unsigned h) {
        while (h) {
            --h;
            delay_seconds(3600);
        }
    }
    
    void delay_days(unsigned d) {
        while (d) {
            --d;
            delay_hours(24);
        }
    }
    

    Suddenly, you can with a single call delay_days(65535u) on a 16-bit processor create a delay of more than 179 years - longer than the longest human life. So why have a huge number of delay() calls after each other?

    Note of course that a busy-loop delay that just counts clock cycles will give too long delays in more complex designs where the processor may allocate clock cycles to other things - like interrupt processing. That's why it's best to only create very short "at least" delays using busy-loop delays and make use of timers or other hardware to create longer delays with good precision.

    I think you need to figure out what you want. You want to learn how to program? Then you can't give up and demand solutions from other people whenever you get stuck. You have to be willing to invest whatever time it takes to learn. As you learn, you'll notice that what you originally thought of as hard is actually quite simple. Just as it's extremely hard to implement walking robots but we humans manages quite well after a bit of training. There is no shortcut to avoid the need for training - you really do need to invest own time!

Children