Positron Compiler Documentation

HSerialx_ChangeBaud

Source: Positron16 Compiler User Manual, PDF page 238

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 }

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 = 24FJ64GA306
                                     ' Select the device to compile for
Declare Xtal = 32
Declare HSerial_Baud = 9600
                                     ' Set the Baud rate for USART1 to 9600
Declare HRSOut1_Pin PORTB.0         ' Set PORTB.0 as USART1 output pin
RPOR0 = 3
                                     ' Configure the PPS for USART1 on PORTB.0
HRsoutLn "Hello World at 9600 Baud"
DelayMs 2000
                                   ' Wait for 2 seconds
HSerial1_ChangeBaud 115200
                                     ' Change the Baud rate to 115200
HRsoutLn "Hello World at 115200 Baud"
Stop