B4R Question How to set serial port 1 to 9600 8E1

candide

Active Member
Licensed User
in B4R, Serial1.Initialize(9600) Uses the default 8N1 configuration.

if you want something different, i think you have to use HardwareSerial.h in inline C
 
Upvote 0

Gerardo Tenreiro

Active Member
Licensed User
in B4R, Serial1.Initialize(9600) Uses the default 8N1 configuration.

if you want something different, i think you have to use HardwareSerial.h in inline C
thanks candido
Indeed I already found the solution.
I leave it here for future reference.

'Public SerialNative0 As Stream ' Puerto Serie 1


'++++++++++++++++++++++++++++++++++++++++++++++++
'+ Inicializa el Puerto Serie 1 del Codificador +
'++++++++++++++++++++++++++++++++++++++++++++++++
'
Pinos del Puerto Serie 2
X1.Inicializar(1,TX1.MODO_SALIDA)
RX1.Inicializar(3,RX1.MODE_INPUT_PULLUP)
'Inicializa Puerto Serie 1
RunNative("SerialNative0", Null) ' Puerto Serie del VF
Inicializa Puerto Serie 1
PS1.Inicializar

'#if C
'void SerialNative0(B4R::Object* unused)
'{
'::Serial1.begin(9600,SERIAL_8E1,3,1);
'b4r_main::_serialnative0->wrappedStream = &::Serial1;
'}
'#End If
(SerialNative0, "En_Newdata","En_Error")
 
Upvote 0
Top