If building the projects in MPLAB fails with an "XC-16 toolchain missing" error, close MPLAB, install the C compiler (xc16-vx.xx-full-install-windows64.exe) and try again.
If you did install the C compiler but MPLAB was running, close and reopen MPLAB and try again.
Cyclone IV support (or Cyclone V) must be enabled for Quartus to run the project from Lab 1. If Quartus complains about "device support," uninstall, re-install and make sure these boxes are checked
Don't put spaces in filenames. Keep path lengths reasonably short. Failure to adhere to these guidelines can cause mysterious bugs later.
Put pic24_code_examples and nsc_quartus in C:\ece3724, not OneDrive or My Documents folder. Even though you can look inside the archives in File Explorer, you need to extract them from the zip file.
Browser/anti-virus may block downloads (particularly with BullyCPP which is an .exe file). If clicking on a link opens a new tab and then immediately closes it, right-click and "Save Link As..." Then go to your downloads window (Ctrl-J in Firefox and Chrome) and keep the file, ignoring the warnings about malicious downloads.
If VirtualBench does not show up automatically when the scope is plugged in, try installing the drivers: VirtualBench USB Scope: ni-virtualbench_xx.x_online_repack.exe
If ModelSim won't run after the Quartus project is compiled, go to Tools > Options > EDA Tool Options. For "Directory Containing Tool Executable", ModelSim (3rd from bottom) and ModelSim-Altera (bottom) should contain C:\intelFPGA_lite\17.1\modelsim_ase\win32aloem:
If the simulation fails to launch after correctly configuring the path to Modelsim (see text in yellow), there may be a permissions problem.
Double-click on modelsim.exe in C:\intelFPGA_lite\17.1\modelsim_ase\. If Windows asked you if it's OK to run this file, you have a permissions problem.
If this is the problem, exit Quartus, then run it as Administrator. Compile your design as usual and it should now work.
If your project compiles in Quartus, opens ModelSim, but then has an error like this:
Check that nsc.bdf is set as the top level entity in the Quartus project Hierarchy.
Wrong
What you should see
You can change it by going back to Files in the dropdown and right-clicking nsc.bdf, then selecting "Set as Top-Level Entity".
If your simulation looks funny (wrong number, addresses aren't 16-24, jumps from line to line erratically, bunch of Z's, etc):
Check myrom.v first.
Are your addresses (line numbers) 5 bits?
Are your instructions 7 bits?
The first two bits of the instruction is the opcode. 00 = JMP, 01 = JC, 10 = OUT. Check with your comments to make sure you're doing what you want.
Check the second five bits (operand) to make sure the address/numbers are correct.
Check that you start at line 0, jump immediately to line 8, execute your program and then jump back to line 8. The default case should never execute. You need to have specifically added a line to the program to jump to line 8.
Next, check your schematic (nsc.bdf). Did you widen all your buses? Pay particular attention to single control lines e.g. mem[#]. If they're supposed to represent bits from the opcode, do they?
Finally, check your other Verilog files. Besides myrom.v, you should have edited:
mycounter.v
myreg.v
nsc.vt
If the labels on your schematic are enormous and difficult to read, try changing the scale of your display. Hit the Windows key, then type in "Scaling". Select "Change the size of text, apps, and other items."
A common error is to be viewing/modifying a source code file from one project while actually debugging another project. When you are done working on a project, close it.
I am editing mptst_word but assembling mptst_byte. It's not going well.
If your project won't build in MPLAB (possibly with a "simulator not found" or "makefile not found" error, and you're sure it's not due to syntax errors, try the following solutions in order:
Recreate the project (see below for instructions). If this doesn't work...
Redownload/extract archive containing code for the lab. The download may have been incomplete, or something could have happened to the files on your disk. If this is also unsuccessful...
Uninstall/reinstall XC16 Compiler and MPLAB.
If you suddenly receive an "Error 255 compilation error," exit and restart MPLAB. If you continue to receive this error, close MPLAB again, hit Ctrl-Alt-Delete, and select Task Manager. Close any MPLAB tasks or processes, and restart MPLAB.
Do not paste code from Outlook or PDFs directly into MPLAB. It often contains invisible characters that will cause mysterious errors.
In the ebook and lecture slides, variable names are prefaced with underscores. In the lab we do not do this for reasons of compatibility with existing code.
You can't move a literal (number) right into data memory (variable). You have to move it into a register and then move it from the register to the variable. If you want to put it into a 16-bit variable (u16_something), you can use register W0-W7. If it's an 8-bit number, it has to go into WREG.
If you have confusion on the usage of WREG and W0, refer to the PIC24 Assembly Primer. In short, if you're using byte-sized quantities and a variable in the same instruction it's WREG, otherwise it's W0.
Note that the bitwise inclusive or operation, |, is performed as IOR, not OR
A prefix of 0 indicates an octal number. If part of your student ID number that you need to use in a program starts with a 0, omit it or you'll experience odd results or compilation errors. For example, for decimal #0123, just use #123 instead. For hex #0x0123 use #0x123.
Do not use the variable names a or b - they are reserved names for the 40 bit accumulators used by DSP instructions. Using them will give errors.
Some computers seem to read CTRL+V as two distinct keypresses. If pasting strings does not give you an UART overflow, try installing an older version of BullyCPP.
1. Finish Debugger Session (Shift-F5).
2. Right click on your project name in the Project window. Select Properties (all the way at the bottom of the context menu in MPLAB X 6.15).
3. Under Categories on the left, select Simulator:
4. In the dropdown under Options for Simulator/ Option categories, select "Uart1 IO Options":
5. Check the "Enable Uart1 IO" box
6. Click Apply and debug the project. Check your output tab. If you get errors and can't debug, you won't be able to see if these steps worked or not.
7. If the above does not work, you can try, in increasing order of difficulty/time/annoyance:
Opening and closing MPLAB
If your UART tab shows up for another case, copy the contents (Ctrl-A, Ctrl-C, Ctrl-V) of your case file and the C check file over top of the contents of the other case's two files. Explain to the TA what you did, and be sure to rename the file before submitting it.
Uninstalling and reinstalling MPLAB X IDE 6.20
Uninstalling and installing MPLAB X IDE 6.15