Skip to content

Commit d3ea703

Browse files
committed
updted content of write board specific software
1 parent 41120eb commit d3ea703

1 file changed

Lines changed: 78 additions & 0 deletions

File tree

how-tos/write_board_software.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,84 @@ layout: default
66
lang: en
77
---
88

9+
# Writing the Board-Specific Software File
10+
11+
## Overview
12+
13+
This guide explains how to write the board-specific software file for the subsystem board. This involves modifying key parameters and configurations to match the hardware setup.
14+
15+
## Before you start
16+
17+
Before writing the board-specific software file, ensure:
18+
19+
* You have the necessary software development tools installed (e.g., MPLAB X, XC8 compiler).
20+
* You have access to the firmware repository.
21+
* You understand the board’s hardware specifications and required configurations.
22+
23+
## Modifying the Board-Specific Software File
24+
25+
1. **Locate the Board-Specific File**
26+
27+
Navigate to the firmware repository and open the file corresponding to your board (e.g., `board_config.h`).
28+
29+
2. **Update the Microcontroller Settings**
30+
31+
Modify the following parameters to match your board’s specifications:
32+
33+
```c
34+
#define CPU_FREQUENCY 32000000 // Set the correct clock frequency
35+
#define UART_BAUDRATE 9600 // Set the UART communication speed
36+
```
37+
38+
3. **Configure the I/O Pins**
39+
40+
Adjust the pin configurations based on your hardware connections:
41+
42+
```c
43+
#define LED_PIN TRISBbits.TRISB0 // Set LED pin as output
44+
#define BUTTON_PIN TRISBbits.TRISB1 // Set Button pin as input
45+
```
46+
47+
4. **Define Communication Protocols**
48+
49+
If using SPI, I2C, or UART, configure the relevant registers:
50+
51+
```c
52+
void initUART() {
53+
TXSTAbits.BRGH = 1; // High-speed mode
54+
BAUDCONbits.BRG16 = 1;
55+
SPBRGH = 0x00;
56+
SPBRG = 207; // Baud rate setting
57+
}
58+
```
59+
60+
### Updating Other Files
61+
62+
Some additional files may require changes to ensure proper integration:
63+
64+
1. **Modify `main.c`**
65+
66+
Ensure the initialization functions for peripherals and board-specific settings are included:
67+
68+
```c
69+
void main() {
70+
initUART();
71+
while (1) {
72+
// Main program loop
73+
}
74+
}
75+
```
76+
77+
2. **Update `Makefile` or Build Configurations**
78+
79+
If using a custom linker script or additional libraries, ensure they are properly linked in your project settings.
80+
81+
## See also
82+
83+
* [Microchip MPLAB X Documentation](https://www.microchip.com/mplabx)
84+
* [PIC18F67J94 Datasheet](https://www.microchip.com/wwwproducts/en/PIC18F67J94)
85+
* [Troubleshooting Common Compilation Errors](#troubleshooting)
86+
987

1088

1189
[Previous]({{site.url}}/how-tos){: .btn .btn-purple }

0 commit comments

Comments
 (0)