Programming and Debugging MCUs using C
Writing assembly code is not easy, and the programmers of desktop computers have turned to a high level programming language. The high level languages are increasing in popularity, and C is perhaps the most used and most useful language for MCU programming. There are many C compilers available on the market, many of them are free or have a free version. You have to install a C compiler which generates the code for the MCU you want to simulate, and then TINA will automatically integrate it into its C code debugger.
Here are the C compilers compatible with TINA:
PIC18: MPLAB C18 compiler
The HEX code generated buy he compiler are automatically stored in the TSC files. You do not need the C compiler once the C-code is compiled into HEX.
However you need the installed C compiler to check the C-code.
Circuit with the above C-code
If you run the simulation, the LED will light when the logic level on PA0 is high and the voltage pin will show the analog voltage. Note that this voltage follows the voltage of the power supply. The other pins are handled with logic values according to the rules of Mixed Mode Simulation. This makes a big difference compared with external simulation of MCUs compared toTINA. You can also see all the voltages and displays of your complete circuit during the simulation and even follow the operation step-by-step with the help of the TINA C debugger
Debugging C code in MCUs
Just as with ASM and HEX code, you can follow the execution of a C program in TINA.
Circuit generating and checking prime numbers
The C-debugger window