using AT command set in C

This is a discussion on using AT command set in C within the C Programming forums, part of the General Programming Boards category; hi guys, i have to createa program in C which talks 2 modem-to-modem connection this can be done using AT ...

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    7

    using AT command set in C

    hi guys,
    i have to createa program in C which talks 2 modem-to-modem connection
    this can be done using AT
    buthow do i use AT command in C???
    ivesearched on net butcant find anything

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,533
    Tell us which OS and Compiler you're using.

    C can do this, but there is no standard answer you can simply plug in and use.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Aug 2004
    Posts
    7
    it is for linux
    and i am using cygnos g++
    i got bloodshed also but it sux cuz gaveme errors with my previous programs so im not gonna use it

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,533
    > it is for linux
    The whole of linux's access to the outside world is through device drivers, and they can all be found within the "/dev" directory.

    If I remember, the first serial port is accessed through "/dev/ttyS0"

    So it might look something like this
    Code:
    #include <stdio.h>
    #include <string.h>
    #include <unistd.h>
    #include <fcntl.h>
    
    int main ( ) {
        int fd;
        fd = open( "/dev/ttyS0", O_RDWR );
        if ( fd != -1 ) {
            char    *reset = "ATZ";
            int     n;
            n = write( fd, reset, strlen(reset) );
            if ( n == -1 ) {
                perror( "Write failed" );
            }
            close( fd );
        } else {
            perror( "Can't open serial port" );
        }
        return 0;
    }

    > i got bloodshed also but it sux cuz gaveme errors with my previous programs so im not gonna use it
    Perhaps if you posted some code, we could tell you where the real problem lies.
    Many people use it quite successfully.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Aug 2004
    Posts
    7
    it givesme error when i have this
    input.open(argv[1], ios_base::binary);
    butwith gnu it works fine

  6. #6
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    devfs is deprecated in 2.6 kernels.
    Last edited by chrismiceli; 08-20-2004 at 06:47 AM.
    Help populate a c/c++ help irc channel
    server: irc://irc.efnet.net
    channel: #c

  7. #7
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,669

  8. #8
    Registered User
    Join Date
    Aug 2004
    Posts
    7
    oh thnx man helped heaps
    i gotta do this project and i mightbuy a book on serial programming

  9. #9
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    What are you trying to say with that link Codeplug? According to my 2.6.7 kernel, it says that devfs is "OBSOLETE". It says it has been replaced by udev:
    Quote Originally Posted by linux-2.6.7
    Note that devfs has been obsoleted by udev,
    <http://www.kernel.org/pub/linux/utils/kernel/hotplug/>.
    It has been stripped down to a bare minimum and is only provided for
    legacy installations that use its naming scheme which is
    unfortunately different from the names normal Linux installations
    use.
    Help populate a c/c++ help irc channel
    server: irc://irc.efnet.net
    channel: #c

  10. #10
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,669
    Oops, I thought devfs was the new thing. Been heads-down in Windows for too long (but it pays the bills).

    gg

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21