This page shows the process for creating and attaching a very simple SCL program.
A Simple SCL File
SCL files are simply text files, any text editor can be used to create and edit them.
Here is a simple SCL program that will be used as an example in the following sections. Put this program in a file called mySCL.scl:
testbench for "pic18f4620" is begin process is begin ADRESH <= 16#BB#; wait; end process; end testbench;
The details of this SCL program, along with the rest of the SCL language, will be described in detail later. For now it is enough to know that this SCL program will set the ADRESH SFR to 0xBB.
This section creates a simple simulator debug session in MPLAB® X and then executes the SCL program created in the last section.
Open MPLAB® X IDE and create a simple, non-terminating, PIC18F4620 project using the simulator as the debug tool. Here is a likely program:
- Create a watch on the ADRESH register and observe that its value is 0x00.
- Debug Run the program.
- Open the stimulus window from the MPLAB® X IDE main menu: Window ▶ Simulator ▶ Stimulus
- In the Stimulus window, click the Attach SCL File button (second from top on left hand side), and browse to the mySCL.scl file created in the first step.
- Click the Open button. At this point the mySCL.scl program will be executed.
- Return to the Watches window and observer that ADRESH is now 0xBB!
Congratulations, you have just executed your first SCL program which injected a value to an SFR while during simulator execution!
Attaching in MDB
You can also attach SCL files from the MDB command line using the stim command: