Initial import of onewire-to-usb bridge
[onewire] / getting_started.txt
CommitLineData
bba33fe1
JM
1This project is a general template file for the PIC12 Family of
2microcontrollers. It's purpose is to provide a project shell for users to
3get started designing their own applications. Final qualification and testing
4of this project is left to the user.
5
6ADVANCED USER TIP
7
8From the main menu, refer to the Task list by going to Window > Tasks (Ctrl+6).
9As long as the task window is not configured to filter out any tasks,
10the getting started TODO list embedded in this project will be displayed.
11
12Make sure the 'Show tasks for the main project and for the open projects which
13depend on it' option is selected on the left hand side of the Tasks window so
14that tasks related to other projects are not active.
15
16HOW TO ADD YOUR OWN CODE TO A TEMPLATE
17
18STEP 1
19
20First install the appropriate C compiler if you have not done so already.
21
22See www.microchip.com/compilers
23
24Next, build this project by clicking the Clean and Build Icon (the hammer and
25broom symbol) in the MPLAB X IDE Toolbar. If this project builds, then you are
26ready to make changes for your own application. If the project does not build,
27you need to troubleshoot why the project does not build before moving on.
28
29STEP 2
30
31Embed your device's configuration bits into the code. Instructions for this
32are commented in configuration_bits.c
33
34STEP 3
35
36Unless interrupts are not used in your application, fill in the interrupt
37vector code. Code stubs are provided in interrupts.c. Check the device
38datasheet to confirm that you are servicing all the relevant enabled
39interrupts in your application within the ISR. Note that it is important
40to check interrupt flags in sequence within one conditional statement to
41avoid interrupt contention which could result in corrupting the interrupt
42context.
43
44STEP 4
45
46Define system parameters such as the system operating frequency in system.h.
47
48If your device stores an oscillator calibration value at the end of program
49memory, incorporate the _READ_OSCCAL_DATA() function in system.c. The device
50datasheet will tell you if calibration data is stored at the end of the
51device memory.
52
53Add system level functions to system.h and system.c. For example, if
54you want a function to determine the reset source of the device to know if you
55need to backup data, do an oscillator switch, enter a low power mode, etc...
56these types of functions may be added to system.c and prototypes can go in
57system.h.
58
59STEP 5
60
61Add user level functions to user.h and user.c. User level functions are
62functions that initialize I/O, initialize user peripherals like the ADC,
63compute user algorithms, perform calculations on sampled user data, and so on.
64User function prototypes and macros may be placed in user.h, and user
65functions themselves may go in user.c
66
67STEP 6
68
69Add code to main.c on the line that says <INSERT USER APPLICATION CODE HERE>.
70For example, here you would call functions in user.c or system.c, or possibly
71setup your own state machine or primary code loop.
72
73Global variables may be added to main.c as well. As a general practice, macros
74and prototypes may go in header files, but variable declarations should not
75go in .h files. Variable declarations should be placed in .c files.
76
77STEP 7
78
79Design the rest of your application. Add new files to the application, and
80test the finished product.
81
82STEP 8
83
84Document what the project does and include other project information in
85project_information.txt.
86