Positron Compiler Documentation

HSerialx_ChangeBaud

Source: Positron8 Compiler User Manual, PDF page 231

Syntax

Hserial1_ChangeBaud Baud Value, { Display Actual Baud }

or

Hserial2_ChangeBaud Baud Value, { Display Actual Baud }

or

Hserial3_ChangeBaud Baud Value, { Display Actual Baud }

or

Hserial4_ChangeBaud Baud Value, { Display Actual Baud }

or

Hserial5_ChangeBaud Baud Value, { Display Actual Baud }

Overview

Changes the Baud rate of a USART for the HRsoutX/HRsinX and HSeroutX/HSerinX commands.

Parameters

Baud Value is a constant value that signifies which Baud rate to set the USART at. Display Actual Baud is an optional constant of 0 or 1 that will produce a reminder message in the IDE that indicates what the actual Baud rate is, and its error ratio.

Example

Device = 18F25K20
Declare Xtal = 20 ' Tell the compiler the device will be operating at 20MHz
Declare Hserial_Baud = 9600
                                  ' Set Baud rate to 9600 for HRsoutLn
HRsoutLn "Hello World at 9600 Baud"
DelayMs 2000
                                  ' Wait for 2 seconds
HSerial1_ChangeBaud 115200
                                  ' Change the Baud rate to 115200 for USART1
HRsoutLn "Hello World at 115200 Baud"
Stop