• No results found

CCS PIC 'C' Compiler Tutorial

N/A
N/A
Protected

Academic year: 2021

Share "CCS PIC 'C' Compiler Tutorial"

Copied!
58
0
0

Loading.... (view fulltext now)

Full text

(1)

,

,

(2)

CCS PIC “C”

COMPILER TUTORIAL

ADEEL

ANWAR

: Created on 2nd MAY 2010

(3)

I am making this tutorial with the

motivation

that, it will be helpful for

the fellow students and it’s a small

contribution toward students

society.

I hope and expect that the students

coming afterwards will contribute

further and we will

improve

(4)

CONTENTS

Basic Tutorial

Pic wizard

Pic Device Selector

Fuses and Interrupts list

Serial Port Moniter

:

Note “Basic Tutorial” (for Beginners is sufficient for creating and compiling)

. ( & )

(5)

Basic Tutorial

Creating new Project

Adding Source file

Writing and editing source file

Compilation

RAM/ROM percentage

View generated assembly code

(optional)

(6)

WE WANT TO CREATE A NEW PROJECT

(7)

(8)

BLANK SOURCE FILE “prg2 c. ”

(9)

“ ” , “ ” & “ ”

HEADER FILES SPECIFING CHIP NO CRYSTAL FREQUENCY SERIAL PORT PARAMETERS RESPECTIVELY MAIN LOOP

(10)

OBSERVE THESE -” SIGNS WITH main “ ” “while” AND for “ ”

THERE IS ALSO AN ENDING SYMBOL

“ ” , “ ”

GENERALLY THESE SYMBOLS ARE ATTACHED TO ALL THE LOOPS IF ELSE OR ANY “{ }”

(11)

“-”

(12)

“+” “ ”

SIGN CHANGES TO AND ALL THE STATEMENTS INSIDE for LOOP ARE MINIMIZED

(13)

WE HAVE WRITTEN THE CODE NOW WE WANT TO COMPILE IT ( )

CLICK 1

( ) CLICK 2

(14)

COMPILATION IN PROGRESS

“RAM AND ROM PERCENTAGE INDICATE HOW MUCH RAM OR ROM OF MICROCONTROLLER THE WRITTEN CODE WILL USE” “ ” ,

:

(15)

.

(16)

“ ”

(17)

“ ” “ ( )”

THE C STATEMENT output_D 0 IS CONVERTED TO FOUR ASSEMBLY STATEMENTS

“ ” “ ” ( ). - “ ”

(18)

SOURCE FILE COF FILE HEX FILE (

(19)
(20)

COLLEGE OF AERONAUTICAL ENGEENERING CAE

INTRODUCTION

Pic wizard is a useful tool that helps the user

for initializing peripherals and writing code

for PIC u-Controller.

Different peripherals options/settings are

presented in form of Graphical User Interface

(GUI).

It creates the basic layout of the code that

include different interrupt service routines,

initialization parameters for timers,

interrupts and other device peripherals etc

.

(21)

( ) CLICK 1

( ) CLICK 2

(22)
(23)

WIZARD WINDOW

FEATURES WINDOW

(24)

( ) GENERAL 1

SELECT DEVICE

:

(25)

OSCILLATOR

- /

(26)

( ) CLICK 1

-USER WANTS TO USE RS 232

(27)

( ) CLICK 1

TIMER 1 DISABLED

. . .

TIMER 0 WITH 2 us Resol AND 51 2 us OVERFLOW TIME

(28)

TIMER 1 ENABLED

TIMER 1 SETTINGS

:

(29)

EACH TIMER SETTINGS GENERATES A CODE THAT WILL BE ADDED TO SOURCE FILE AT THE END OF WIZARD ( )

(30)

( ) CLICK 1

/

SELECT A D CONVERTERS

- ( - )

(31)

( ) CLICK 1

(32)

( ) CLICK 1

( ). . AS WE HAVE SELECTED EXTERNAL INTERRUPT PREVIOUS PAGE THIS CODE WILL BE ADDED TO SOURCE FILE

(33)

“ ” IF THERE ARE NO MORE FEATURES THAT USER WANT TO USE CLICK OK

(34)

/ & / . INITILIZATION CODE GENERATED BY WIZARD TO SET REQUIRED PARAMETERS OF TIMER INTERRUPT A D CONVERTER etc

(35)

(

(36)

, , - , / & … HEADER FILE HAS INFORMATION ABOUT THE SELECTED DEVICE CLOCK RS 232 PINS A D CONVERTERS FUSES etc ( )

CLICK 1

( ) CLICK 2

(37)

(38)

“prog1.h” IS HEADER FILE.

:

(39)

CCS PICC

DEVICE

(40)

INTRODUCTION

A large PIC family provides user, the flexibility

to select the chip which fulfill the

requirement optimally.

The devices which have large features are

more costly. So, from Economical point of

view, select the device which

only

has

those features that the design requires.

Device Selection Tool

is helpful in selecting

the appropriate chip which meets the

(41)

( ) CLICK 1

( ) CLICK 2

(42)

“SELECTED” SHOWS THE CHIPS WHICH FULFILL THE CRITERIA

“CRITERIA CONSISTS OF THE MINIUM FEATURES THE CHIP SHOULD HAVE”

. SPECIFY THE PIC FAMILY THE SELECTED CHIP SHOULD BELONG

(43)

, “ ’ ” “ ” IF WE REQUIRE USB PORT SO WE CHANGE Don t Care TO Yes

(44)

. ( )

Min 256 Byte RAM AND 8 KB ROM 8192 Bytes IS REQUIRED

- /

(45)

“ ” . . .

(46)

( ) CLICK 1

(47)

& .

(48)

FUSES AND INTERRUPTS

LIST

This tool of the compiler can be used

to see the fuses and interrupts that

can be used for a

specific device

.

Thus, it provides a quick glance, at

the fuses and interrupts options

available for a particular Pic device,

instead of tedious search in the

(49)

( ) CLICK 1

( ) CLICK 2

(50)

( . . ) SELECT DEVICE e g 16F877

(51)

( ) ALL THESE FUSES CAN BE USED FOR SELECTED DEVICE 16F877

(52)

( ) CLICK 1

(53)

SELECT DEVICE

(54)

SERIL PORT MONITER

This tool works same as hyper terminal

but in new windows (vista and later)

there is no hyper terminal so this tool

can be used to send/receive data

(55)

( ) CLICK 1

( ) CLICK 2

(56)

SELECT COM PORT

(57)

TYPE DATA TO SEND TO SERIAL PORT RECEIVED DATA APPEAR HERE

(58)

END

Don't blame the unfavorable circumstances that stops you from "

doing what needs to be done as the key lies in our decision not "

References

Related documents

There are different ways of translating a programming language Lecture 0 11 Compiler Source Code Binary/Assembly Interpreter Source Code Compiler Source Code Bytecode VM.. Ex.: C,

A következő fokozata a közösségi crM-nek feltételez- hetően az lesz, amikor a közösségi médiát használva, a felhasználót rábírva arra, hogy magától szolgáltas-

Research Question #3 was analyzed using a independent t test to examine the significance of the difference between first grade students who were identified for Reading Recovery

If an employee chooses not to continue the life insurance during an unpaid leave, upon their return to active, eligible employment, they will be required to complete a Life

The randomized controlled trial found that early closure of a temporary ileostomy in selected patients was superior in terms of the primary outcome; number of complications up to

If you selected a WFS-1 file system format as the source, and you click this link, you are returned to the previous page, which now displays the error message Failed to set the

Offer activities and shows that allow us to monitor the maximum capacity of the area and make it easy to maintain a 2 meters distance from others.. The correct and constant

Whilst all access-based consumption challenges traditional concepts of product ownership, in comparison to sharing or renting pay-per-use service provision requires the acceptance of