Mplab ide software, Computer Graphics

Assignment Help:

MPLAB C18 TOOL (MC18)

The MPLAB C18 compiler was designed as a full featured ASNI- compliant C - complier for the PIC18 family of 8bits MCUs. MC18 compiler is integrated with component of Microchip's Integrated Development Environment (IDE) enabling source level debugging with MPLAB ICD 2 in -circuit debugger, MPLAB REAL ICE emulator and MPLAB SIM simulator.

Starting a new Project on the MPLAB IDE software:

• On the toot bar , Clicked Project -> Project Wizard , clicked next
• Select device i.e PIC18F452, if it isn't already selected, clicked next
• Selected Microchip C18 Toolsuite. some items in Toolsuite Contents were with a red X, I selected them and clicked Browse.

The default locations for the files are:

MPASM Assembler - C:\MCC18\mpasm\mpasmwin.exe
MPLINK Object Linker - C:\MCC18\bin\mplink.exe (I ensure did not select _mplink.exe)
MPLAB C18 Compiler - C:\MCC18\bin\mcc18.exe
MPLIB Librarian - C:\MCC18\bin\mplib.exe

• Clicked Browse and selected the name and location of my new project
• I did not add any existing files to the project since, it is been made from scratch
• Once the project has beed created, I was able to see the empty project folders in the project window

Hence, the Linker, Lib and source header files are now added to the project
Opened a file, add the source and header files to the PIC and saved it: by Clicking File -> New .
Then saved as dot c (xxx.c) and (xxx.h) respectively for each interface codes .

The C18 compiler provides a header file has the definitions for all ports and pins for each microcontroller it supports. The default directory for these files is C:\MCC18\h .The header file below have been used for this project

#include

The Delay10KTCx() function and other delay functions are documented in hlpC18Lib.chm in the C18 documentation directory (see above). You will need to add the following line to the top of your file:

#include

The datasheet states that each port has three registers for its operation. These registers are as follows:

• TRIS register (for data direction register 0 - output, 1 - input)
• PORT register ( to reads the levels on the pins of the device)
• LAT register ( for output latch)

In other words, the PORT register are used for input operations, LAT register for output operations, while the TRIS register are used to select between input and output on each individual pin.

For example: To control an LED using PORT A Pin 1, we need to first set it to be output using the TRIS register and then be toggled on and off using the LAT register.

A #define statement makes the code much more readable. Usually added after the #pragma config statements:
An example of flashing led is stated below:
#pragma config FOSC = INTOSCIO_EC
#pragma config WDT = OFF // Disable watchdog timer

#define LEDPin LATAbits.LATD1 // Define LEDPin as PORT A Pin 1
#define LEDTris TRISAbits.TRISD1 // Define LEDTris as TRISA Pin 1

The Flash_ Led prototype, I have made PORTA Pin 1 an output and set it HIGH:
void flash_led (void)
LEDTris = 0; // Set LED Pin data direction to OUTPUT
LEDPin = 1; // Set LED Pin
The last step is to add a loop that toggles the pin at an interval:
while(1)
{
LEDPin = ~LEDPin; // Toggle LED Pin
Delay10KTCYx(25);
/* Delay 250K cycles (1 second at 1MHz since each instruction takes 4 cycles) */
}
To test it on the microcontroller:
I download the code in to the PIC via In circuit debugger 2.
• Clicked Project -> Build All or button on the tool bar
• Clicked Programmer -> Program
• If the above two steps were successful, Click Programmer -> Release From Reset
You should now see your LED blinking on and off about once per second.

Now leys look at some I2C codes example is shown below: #include #include

#define SDA P0_0
#define SCL P0_1

void I2CInit()
{
SDA = 1;
SCL = 1;
}

void I2CStart()
{
SCL = 1;
SDA = 0;
SCL = 0;
}
void I2CRestart()
{
SCL = 0;
SDA = 1;
SCL = 1;
SDA = 0;
}
void I2CStop()
{
SCL = 0;
SDA = 0;
SCL = 1;
SDA = 1;
}


Related Discussions:- Mplab ide software

Define emissive and non-emissive displays, What do you mean by emissive and...

What do you mean by emissive and non-emissive displays?  The emissive display changes electrical energy into light energy. The plasma panels, thin film electro-luminescent disp

Procedural animation - computer animation, Procedural Animation - Computer ...

Procedural Animation - Computer Animation This category of animation is utilized to produce real time animation that permits a more diverse series of actions to occur. These a

Multimedia resources, Education courses, skills, and knowledge are sometime...

Education courses, skills, and knowledge are sometimes taught of context because of lack of application of real time examples. To resolve this, educators are using multimedia to br

File format-introduction to computer graphics, File format We want an i...

File format We want an image of a Fly. The wings are incompletely transparent and to present that in our presentation what be problematic if suitable file format is not there.

Acquire the perspective transformation, Acquire the perspective transformat...

Acquire the perspective transformation onto z = - 2 Plane, where (0, 0, 18) is the center of projection. Solution: Now centre of projection, C (a, b, c) = (0, 0, 18) ∴ (n 1

Transformation, Define transformation. Explain all basic transformation

Define transformation. Explain all basic transformation

Exemplify bresenham line generation algorithm by digitizing, Example: Exem...

Example: Exemplify the Bresenham line generation algorithm through digitizing the line along with end points (20, 10) and (30, 18) Solution: m =    (y2 - y1)/( x2 - x1)  =

Windowing transformations - raster graphics and clipping, Windowing Transf...

Windowing Transformations - Raster Graphics and  Clipping From the above section of introduction, we understood the meaning of the viewport and term window that could again be

What are the advantages of the boundary representation, Advantages of the B...

Advantages of the Boundary Representation (i) This format gives efficient picture generation and easy access to other geometric information. (ii) The changes produced by mos

Uses for gif and jpeg files, Uses for GIF and JPEG Files: Microsoft I...

Uses for GIF and JPEG Files: Microsoft Internet Explorer, Netscape Navigator and most the other browsers maintain both JPEG and GIF graphics. Theoretically, you could util

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd