Jump to content

RS232_V2 Baudrate ändern rs232_set_configuration


PaulPaulaner

Recommended Posts

Hallo zusammen,

ich versuche die Baudrate und die Parität für das RS232 Bricklet zu ändern.

Leider bleibt diese unverändert auf RS232_BAUDRATE_115200 und RS232_PARITY_NONE wie ich das Bricklet mal in Betrieb genommen habe, kann das sein?

wenn sich das Bricklet meldet wird es wie folgt initialisiert:

rs232_v2_create(reinterpret_cast<RS232V2 *>(psTemp_Device->vDevice), psTemp_Device->sDevice_UID.toLocal8Bit().data(), &ipcon);     
            

 

rs232_set_configuration(reinterpret_cast<RS232V2 *>(psTemp_Device->vDevice),
                                    RS232_BAUDRATE_9600,//RS232_BAUDRATE_115200,
                                    RS232_PARITY_EVEN,//RS232_PARITY_NONE,
                                    RS232_STOPBITS_1,
                                    RS232_WORDLENGTH_8,
                                    RS232_HARDWARE_FLOWCONTROL_OFF,
                                    RS232_SOFTWARE_FLOWCONTROL_OFF);
 
rs232_v2_register_callback(reinterpret_cast<RS232V2 *>(psTemp_Device->vDevice),
                                       RS232_V2_CALLBACK_READ,
                                       (void (*)(void))cb_readRS232_V2_static,
                                       psTemp_Device);
rs232_v2_enable_read_callback(reinterpret_cast<RS232V2 *>(psTemp_Device->vDevice));

 

Gibt es einen Ablauf wie die Baudrate/Parität usw in Betrieb geändert werden kann?

Da ich verschiedene Baudraten automatisiert durch probieren müsste um das Gerät zu erkennen.

Danke und viele Grüße

 

Link to comment
Share on other sites

Moin,

1 hour ago, PaulPaulaner said:

rs232_set_configuration(reinterpret_cast<RS232V2 *>(psTemp_Device->vDevice),

Das ist die Funktion des RS232 (1.0) Bricklets, du benutzt aber sonst immer die vom RS232 2.0.

Folgendes sollte funktionieren:

rs232_v2_set_configuration(reinterpret_cast<RS232V2 *>(psTemp_Device->vDevice),
                           115200,
                           RS232_V2_PARITY_EVEN,
                           RS232_V2_STOPBITS_1,
                           RS232_V2_WORDLENGTH_8,
                           RS232_V2_FLOWCONTROL_OFF);

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...