serielle schnittstellen



  • [cpp] if (argc == 2) {
    if ((*argv[1] == '1') || (*argv[1] == '2')) {

    config.COMport = _tstoi (argv[1]);
    } else {
    printf ("USAGE: %s [COMPORT]\n\n"%s 1" sends data on COM1\n", argv[0], argv[0]);
    return (-1);
    }
    }

    else {
    printf ("USAGE: %s [COMPORT]\n\n"%s 1" sends data on COM1\n", argv[0], argv[0]);
    return (-1);
    }
    printf ("data on COM%d\n\n", com_port + 1);

    hallo hier benutzt mann comport 1..wenn ich comport 5 benutzen möchte,was soll ich dann ändern?



  • if (argc == 2) 
    { 
      int port = _tstoi (argv[1]); 
      if (port > 0) 
      { 
        config.COMport = port;
      } else { 
        printf ("USAGE: %s [COMPORT]\n\n"%s 1" sends data on COM1\n", argv[0], argv[0]);
        return (-1); 
      } 
    } else { 
      printf ("USAGE: %s [COMPORT]\n\n"%s 1" sends data on COM1\n", argv[0], argv[0]);
      return (-1); 
    } 
    printf ("data on COM%d\n\n", com_port + 1);
    


  • Jochen Kalmbach schrieb:

    if (argc == 2) 
    { 
      int port = _tstoi (argv[1]); 
      if (port > 0) 
      { 
        config.COMport = port;
      } else { 
        printf ("USAGE: %s [COMPORT]\n\n"%s 1" sends data on COM1\n", argv[0], argv[0]);
        return (-1); 
      } 
    } else { 
      printf ("USAGE: %s [COMPORT]\n\n"%s 1" sends data on COM1\n", argv[0], argv[0]);
      return (-1); 
    } 
    printf ("data on COM%d\n\n", com_port + 1);
    

    dadurch erreicht man comport 5 ? wie kann man das erkennen?


  • Mod

    Damit wird jeder numerische Wert als COM-Port erlaubt...


Log in to reply