SPBRG Calculator
Calculate SPBRG register values for USART communication with different crystal frequencies and baud rates.
Input Parameters
Calculation Results
SPBRG Value:
-
Actual Baud Rate:
-
Error:
-
SPBRG (Hex):
-
SPBRG (Binary):
-
Assembly Code:
; SPBRG configuration will appear here
How It Works
The SPBRG (Serial Port Baud Rate Generator) register controls the baud rate for USART communication. The formula used is:
BRGH = 0: Baud Rate = FOSC / (64 × (SPBRG + 1))
BRGH = 1: Baud Rate = FOSC / (16 × (SPBRG + 1))
BRGH = 1: Baud Rate = FOSC / (16 × (SPBRG + 1))
Where FOSC is the crystal frequency. The calculator finds the closest integer SPBRG value and shows the resulting error percentage.