Sunteți pe pagina 1din 41

JawaharlalNehruEngineeringCollege

LaboratoryManual

EMBEDDEDSYSTEMS
For

BE(ECT/IE)

Manualmadeby
Prof.P.A.JADHAV
Prof.A.B.PENTEWAR

AuthorJNEC,Aurangabad

JawaharlalNehruEngineeringCollege
TechnicalDocument
This technical document is a series of Laboratory manuals of Electronics &
Telecommunication and Industrial Electronics and is a certified document of Jawaharlal
NehruEngineeringCollege.Thecarehasbeentakentomakethedocumenterrorfreebut
stillifanyerrorisfoundkindlybringittothenoticeofsubjectteacherandHOD.

TechnicaldocumentNo.ECT/IE/Techdoc/21stOctober2009/.

Recommendedby,
HOD

Approvedby,
Principal

Copies:
1. DepartmentalLibrary
2. Laboratory
3. HOD
4. Principal
2

PREFACE

It is my great pleasure to present this laboratory manual for final year


engineeringstudentsforthesubjectofEmbeddedSystemskeepinginviewthe
vastcoveragerequiredforvisualizationofconceptsofbasicelectroniccircuits.
Asastudent,manyofyoumaybewonderingwithsomeofthequestions
in your mind regarding thesubject andexactly that has been tried to answer
throughthismanual.
Faculty members are also advised that covering these aspects in initial
stageitselfwillgreatlyrelievetheminfuture,asmuchoftheloadwillbetaken
care by theenthusiastic energies ofthestudents,once they areconceptually
clear. Students are advised to thoroughly go through this manual rather than
only topics mentioned in the syllabus as practical aspects are the key to
understanding and conceptual visualization of theoretical aspects covered in
thebooks.

GoodLuckforyourEnjoyableLaboratorySessions.

Prof.A.B.Pentewar
Prof.Miss.P.A.Jadhav
Author

SUBJECTINDEX
Title

Pageno.

1.DosandDontsinLaboratory

2.InstructionforLaboratoryTeachers:

3.LabExercises:
1. StudyOfEDUARM2148Trainerkit.
2. StudyofIDEoverviewProjectcreation,downloading&debugging.
3. StudyofJTagdebugger.
4. WriteaprogramforserialcommunicationusingUART0.
5. Writeaprogram forLEDinterfacing.
6. WriteaprogramtoBlinkLEDs.
7. Writeaprogramforkeyboardinterfacing.
8. WriteaprogramforSteppermotorinterfacing.
9. WriteaprogramforgenerationoframpwaveusingonchipDAC.
10. WriteaprogramforinterfacingoftemperaturesensortoonchipADC.
11. WriteaprogramforinterfacingofEEPROMusingSPIprotocol.

6
11
14
16
18
22
23
30
32
35
36

4.Quizonthesubject

41

5.Conductionofvivavoceexamination

41

6.Evaluationandmarkingscheme

41

1.DOsandDONTsinLaboratory:
1. Donothandlekitwithoutreadingtheinstructions/Instructionmanuals.
2. ReferHelpfordebuggingtheprogram.

3. GothroughDemosofSignalProcessingtoolbox.
4.Strictlyobservetheinstructionsgivenbytheteacher/LabInstructor.
.

2InstructionforLaboratoryTeachers:
1.Labworkcompletedduringpriorsessionshouldbecorrectedduringthenextlab
session.
2.Studentsshouldbeguidedandhelpedwhenevertheyfacedifficulties.
3.Thepromptnessofsubmissionshouldbeencouragedbywayofmarkingandevaluation
patternsthatwillbenefitthesincerestudents.

Studyexperiment:1
Aim

:StudyOfEDUARM2148Trainerkit.

Apparatus

:EDUARM2148Trainerkit.

Theory

Thetrainerkitcontainsfollowingitems:
1. EDUARM72148board
2. SerialcommunicationCable
3. PowerSupplyAdaptor
4. SPJETsCDROM
PowerSupplyRequirement:
The power adaptor works with 230VAC. It produces approximately 9VDC, and the
EDUARM2148 uses on board regulators to provide 5V, 3.3V and 1.8V DC to all
componentsonboard.
Connectingthesystem:
The serial communication cable supplied with the board should be used to connect
the board to a PC running windows95/98/ME/2000/XP/Vista Operating system. Connect
oneendoftheserialcabletoUART0ofEDUARM72148boardandotherendtoPCsserial
port.
PoweringON:
Afterconnectingtheserialcommunicationcableasdescribedabove,youmayinsert
thepoweradaptoroutputjackintotheonboardpowersocket.Plugthepoweradaptorinto
230VACmainsoutletandturniton.ThepoweronindicationgreenLEDwillturnon.

A.EDUARM72148BlockDiagram:
Below figure shows the locations of different components on the EDUARM72148
board.

Below figure shows the locations of different switches and jumpers on the EDU
ARM72148board.

B.SwitchesDetails:
S1:
TurnONthisswitchtoconnectUSBdeviceconnectortoUSBlinesofLPC2148.
S2:
Turn ON this switch to connect UART1 connector to UART1 lines (TxD1/P0.8 and
RxD1/P0.9)ofLPC2148.
S3:
Mode selection switch. The LPC21xx microcontrollers include onchip flash for
storinguserprogramandnonvolatiledata.TheLPC2148have512KBytesflash.Thisflash
isInSystemProgrammable(ISP).TheLPC21xxmicrocontrollershaveabuiltinbootload
program.Uponpoweron,thisbootloadprogramtakescontrolitpassescontroltotheuser
program if pin P0.14 is HIGH and some other conditions are satisfied. Please refer to the
LPC21xx datasheet for further details. On the EDUARM72148 board, the P0.14 pin is
made available on this S3 switch. Turn ON this switch to control the Mode (ISP mode or
Runmode)byFlashMagic.
S4:
Turn ON this switch to connect Seven Segments, RTC (DS1307) and EEPROM
(AT24C512)toI2Clines(SCL0/P0.2andSDA0/P0.3)ofLPC2148.
S5:
TurnONthisswitchtoconnectPOTandLM35toADC0.1/P0.28andADC0.2/P0.29
ofLPC2148.
S6:
Turn ON this switch to connect Buzzer, DAC/TP7 and External Interrupt to
ACOut/P0.25andEINT0/P0.16ofLPC2148.
S7:
Turn ON this switch to connect SPI EEPROM (AT25256) to SPI lines (SCK0/P0.4,
MISO0/P0.5,MOSI0/P0.6andCS/P0.7)ofLPC2148.

C.ConnectorDetails:
UART0:
ThisisaDB9femaleconnector,usedforRS232serialcommunicationwiththePC:
Pin2=UART0RS232TxD(outputofmC)
Pin3=UART0RS232RxD(inputtomC)
Pin4=RS232DTR
Pin5=Ground
Pin7=RS232RTS
AllotherpinsofJ1/UART0areunused.
UART1:
ThisisaDB9femaleconnector,usedforRS232serialcommunicationwiththePC:
Pin2=UART1RS232TxD(outputofmC)
Pin3=UART1RS232RxD(inputtomC)
Pin5=Ground
16x2LCD:
Thisisa16pin,singlelineconnector,designedforconnectiontostandard,textLCD
modules. The pin/signal correspondence is designed to be matching with that required by
suchLCDmodules.
Pin1=GND
Pin2=+5V
8

Pin3=Vlcd
Pin4=P1.25(UsedasRSofLCD)
Pin5=GND
Pin6=P1.24(UsedasENofLCD)
Pin7to10=NoConnection
Pin11=P0.15(UsedasD4ofLCD)
Pin12=P0.17(UsedasD5ofLCD)
Pin13=P0.22(UsedasD6ofLCD)
Pin14=P0.30(UsedasD7ofLCD)
Pin15=Backlighting
Pin16=GND
128x64GraphicsLCD:
Thisisa20pin,singlelineconnector,designedforconnectiontostandard,128x64
Monochrome Graphics LCD modules. The pin/signal correspondence is designed to be
matchingwiththatrequiredbysuchLCDmodules.
Pin1=GND
Pin2=+5V
Pin3=Vlcd
Pin4=P1.25(UsedasRSofGLCD)
Pin5=P0.15(UsedasRWofGLCD)
Pin6=P1.24(UsedasENofGLCD)
Pin7=P0.10(UsedasD0ofGLCD)
Pin8=P0.11(UsedasD1ofGLCD)
Pin9=P0.12(UsedasD2ofGLCD)
Pin10=P0.13(UsedasD3ofGLCD)
Pin11=P0.18(UsedasD4ofGLCD)
Pin12=P0.19(UsedasD5ofGLCD)
Pin13=P0.20(UsedasD6ofGLCD)
Pin14=P0.21(UsedasD7ofGLCD)
Pin15=P0.22(UsedasCS1ofGLCD)
Pin16=P0.30(UsedasCS2ofGLCD)
Pin17=
Pin18=
Pin19=+5V
Pin20=GND
JTAGConnector:
Thisstandard20pinJTAGconnectorprovidesdebuggingsupportfortheLPC21xx.
Thisconnectorismountedontopsideoftheboardasshowninfigure1.JTAGcableslike
SJTS or SJTU can be connected to this connector, while other end of the cable can be
connectedtoPCCOMportorUSBport,respectively.Debuggersoftware(likethedebugger
builtintoSCARM)allowsJTAGbaseddebugging.ItisalsopossibletousethirdpartyJTAG
basedemulators/debuggers.ThepinoutofJTAGConnectorisgivenbelow:

J7:
Thisis26pinduallineheaders.ItbringsoutI/OandmostofthepinsoftheLPC21xx
microcontroller.Further,5VandGNDarealsomadeavailableontheseconnectors.These
connectorsareintendedforusetoconnectexternalperipherals.
Thepin/signaldetailsofJ7areasbelow:

10

Studyexperiment:2
Aim

:StudyofIDEoverview(Projectcreation,downloading&debugging)

Apparatus

:EDUARM2148Trainerkit.

Theory

A.SCARMInstallation:
As a part of the SCARM software package, you should have received a CDROM.
Please insert it into the CDROM drive and run SETUP.EXE from it. Once you start the
SETUP program, follow the instructions on the screen to complete the installation. The
setupprogramwill:
Copytherequiredfilestoyourharddisk
Ifthereareanycompressedfiles,uncompressthem
CreateaprogramgroupforSCARM
Once you have successfully installed the software on your hard disk, you can run it by
clickingon
Start/Programs/SPJ SCARM/SIDEARM. However, we recommend, that you gothrough
thisusersmanualbeforeyouactuallystartusingit.
SCARM is SPJETs C Compiler for ARM. It also includes an IDE and other tools like
Debugger, Visual Code Generator (VCG) and Terminal Emulation Utility (SPJTerm).
ThisdocumentdescribesstepstocreateARMapplicationsinCusingtheSCARM.
AboutProject:
Whatisaproject?
AprojectisafileinwhichSIDEARMstoresallinformationrelatedtoanapplication.E.g.it
storesthename(s)ofCand/orAssemblersourcefile(s),memorysizetobeusedandother
optionsforcompiler,assemblerandlinker.
Openingaproject:
Toopenanexistingprojectfile,selectProject/OpenProjectfromthemenu.
Creatinganewproject:
Tocreateanewproject,selectProject/NewProjectfromthemenu.
Changingprojectsettings:
To change the project settings (such as adding or removing C and/or Assembler source
file(s),changingmemorysettingsetc.),selectProject/Settingsfromthemenu.

B.SCARMQuickStartforcreatingCapplications:
1.StarttheSIDE_ARMprogram(i.e.theIntegratedDevelopmentEnvironment)from
start\Programs\SPJSCARM.
2.FromProjectmenu,selectCloseproject(ifanyprojectisopen).
3. From Project menu, select New Project. The Open dialog window will be displayed.
Selectthedesiredpathwhereyouwishtocreatethisnewproject.(Forexample,C:\SPJ).
11

CAUTION:Thepathandfilenamemustnotcontainspaceorotherspecialcharacterssuch
astab,comma,semicolonetc.IntheFilenamefield,typethenameoftheproject,without
anyextension.Forexample,youmaytypePROG1.ThenclickontheOpenbutton.
4. The action in the previous step will display the Project Settings dialog window. This
dialogwindowhas3differentpartsnamedCompilerOptions,LinkerOptions,and
Source Files. Any of these 3 parts can be displayed by clicking on the corresponding
name near the top of this dialog window. Currently, the Compiler Options will be
automaticallydisplayed.Ifthetargetmicrocontroller(mustbeamemberofARMfamily)is
known, you may select the appropriate Manufacturer from the list and then select the
appropriatemicrocontrollerfromthedevicelist.Ifthetargetmicrocontrollerisnotknownor
ifyoucannotfinditinthelist,thenyoumaysimplyselectPhilipsasthemanufacturerand
LPC2148asthemicrocontroller.
5.ClickonLinkerOptionstodisplaythatpartofthedialogwindow.Inthiswindow,you
willseealistof8MemoryBanks,withnamessuchasMemory#1,Memory#2andso
on.Inyourtargethardware,theremaybenoneor1ormorenumberofcontiguousmemory
blocks connected to the ARM microcontroller. Check the appropriate number of memory
banks to reflect the targets memory blocks. For each checked memory bank, specify
memory start address (in Hexadecimal) and memory block size (in decimal). Size maybe
specified either in number of Kilobytes (KB) or Megabytes (MB). Some of the memory
blocksmaybereadonly(e.g.flashorconventionalEPROM).Accordingly,youmaycheck
or uncheck the Read only box. Based on thisinformation about memory banks, the IDE
will automatically create theLinker Script. This autogenerated scriptis adequate for most
users.However,ifyouwishtouseyourownscriptfileinsteadofthisautogeneratedscript,
you may check the Use differentlinker script box and further click on the browse button
(marked)andselectappropriatelinkerscriptfile.
6.ClickonSourceFilestodisplaythatpartofthedialogwindow.Thiswindowwillindicate
thatIDEhasautomaticallyadded2filesinthisnewproject:PROG1.CandSTARTUP.ASM.
The STARTUP.ASM file is automatically created by the IDE and is required for all C
projects.Similarly,theIDEhasautomaticallycreatedanemptyCfile(PROG1.C).Ifthefile
PROG1.C already exists in the same path, then IDE would neither create/overwrite it nor
modifyitbutitwillanywayaddittotheprojectautomatically.Ifyouwishtoaddmorefilesin
thisproject,thenclickontheAddfilebutton,selectthedesiredfilenameandthenclickon
Open button. Now the Project Settings dialog will indicate that selected file has been
addedintotheproject.Whenallnecessaryfileshavebeenaddedtotheproject,clickOK
buttontocreatethisnewproject.
7.ThePROG1.CfilecreatedbytheIDEwillbeanemptyfilecontainingonlytheframeof
mainfunction.Youmaywritethedesiredprogramstatementsinthisfile(orotherfilesthat
youmayhaveaddedtotheproject).Whendone,selectSavefromFilemenu.Ifyouhave
modifiedmorethanonesourcefiles,thenselectSaveAllfrom Filemenu.
8.FromtheCompilemenu,selectBuild.ThiswillinvoketheCompilertocompilethefile
PROG1.Candfurther(assumingnoerrors)invokethelinkertocreatethe.HEXfile.Ifthere
are any errors or warnings during the process of compiling, assembling or linking, then
thosewillbedisplayedintheoutputwindow(belowtheeditorwindow).Ifthereareerrors,
then you may correct those by making appropriate changes to the program select Save
12

from File menu to save the changes and then again select Build from Compile menu.
Repeatthisuntiltherearenoerrors.
9.Youmayinspectcontentsofthefolderwhereyourprojectfilesreside.Whenthereareno
errors and build has completed successfully and then you will see a filename with same
name as the project name and extension .HEX (in above example, PROG1.HEX). This is
thefilethatyouwillneedtousetoprogramyourmicrocontroller.

C.Downloading&RunningPrograms:
The LPC2148 microcontrollers include onchip flash for storing user program and non
volatiledata.LPC2148onEDUARM72148have512KBytesflash.ThisflashisInSystem
Programmable(ISP).Thereforeitispossibletodownloaduserprogramintoonchipflashof
LPC2148,throughserialportconnectedtoPC.Fordoingso,acertainpositionofS3switch
isrequired.S3SwitchshouldbecontinuouslyON.Thissectiondescribeshowtousethe
softwareFlashMagictodownloadprogramintoLPC2148.
1.HowtoinstallFlashMagic:
The CD you have received with this board contains SCARM, C Compiler for ARM.
Installit. Afterinstallation go to folder C:\SCARM\Utilities. This folder contains 5 zip files.
InstallFlashMagicfromFlashMagic3.71.zip.ExtracttheFlashMagic3.71.zipandthenrun
FlashMagic.exefromtheextractedfiles.(IfyouhavewrongversionofFlashMagicalready
installed,thenpleaseuninstallitfirstandtheninstallnewversion).
2.DownloadandRunprogramusingFlashMagicintoLPC2148:
AfterinstallationofFlashMagic,openit.
InFlashMagicgotoOptions>AdvancedOptions>Communications.CheckHighSpeed
CommunicationsandkeepMaximumBaudRateas19200.ClickonOK.
Again in Flash Magicgo to Options>Advanced Options>Hardware Config. Use DTR
andRTStocontrolRSTandP0.14optionshouldbechecked.ClickonOK.
(After doing above mentioned settings,Flash Magic storesit means for the next time just
verifyifthesesettingareproperornot.Iftheyareproperthenyoucandirectlyfollowbelow
mentionedprocedure)
a)ConnecttheJ1/UART0connectorofEDUARM72148boardtoCOM1orCOM2ofaPC,
usingtheserialcommunicationcable(suppliedwiththeboard).
b) Keep S3 switch in ON position. (You can keep S3 switch continuously ON) Switch ON
powertotheEDUARM72148.
c) Do proper settings in Flash Magic (COM Port: COM1 (if other choose it), Baud Rate:
38400, Device: LPC2148, Interface: None (ISP), Enable Erase blocks used by Hex File,
Browsethefilewhichyouwanttodownload)andclickonStartbutton.
d)FlashMagicwilldownloadtheprogram.WaittillFinishedcomes.
e) After downloading Flash Magic automatically resets the EDUARM72148 board and
program executes.Youcanseeoutputaccordingtotheprogram.
f) If again you want to Reset the board then Switch OFF and ON the power to the EDU
ARM72148board.Youcanseeoutputaccordingtotheprogram.
Note:FlashMagiccanbeusedtodownloadtheprogramintootherPhilipsMicrocontrollers
also.SeethelistinFlashMagicitself.

13

Studyexperiment:3
Aim

:StudyofJTAGDebugger.

Apparatus

:EDUARM2148Trainerkit.

Theory

A.JTAGCableforDebugging:
1.Type:
SJTS:SerialJTAGCable.
2.Contents:
TheJTAGCableconsistsoffollowingparts:
Dongle(asmallboxwithconnectorsonbothends).
Cable
ThedongleconsistsofsomeelectroniccircuitforinterfacingtheJTAGportoftarget
processortothehostcomputer.Thecableisabunchofwirestoconnectthedonglewith
theJTAGportoftarget.
3.PowerSupplyRequirements:
TheJTAGcabledrawspowerfromthetargetboard.Thusitdoesnotrequirea
separatepowersource.
4.ConnectingJTAGCable:
SJTS:
ThereisaDB9femaleconnectorononeendofthedongle.Thisdirectlymateswith
thePCCOMportwhichhasaDB9maleconnector(oryoucanconnectyellowcolorserial
cablesuppliedwithSJTSbetweenDB9femaleconnectorononeendofthedongleandPC
COMportwhichhasaDB9maleconnector).TheotherendofthedonglehasDB25
femaleconnector.ThereisaDB25maleconnectorononeendofthecable.TheseDB25
femaleandDB25maleconnectorsaredesignedtomatewitheachotherdirectly.Theother
endofthecablehasa20pinheader.ThisshouldbeconnectedtotheJTAGconnectorof
thetargetboard.
CAUTION:
TheJTAGCablemustnotbeconnectedordisconnectedwhenpowerisappliedtothe
targetboard.Turnoffpowertothetargetboard,connecttheJTAGCableandthenyoumay
turnonpowertothetargetboard.ConnectingtheJTAGCablewithincorrectpolarity/
orientationmaypermanentlydamagetheEDUARM72148boardand/ortheJTAGCable.It
willalsomakethewarrantyvoidforboththeproducts.

B.Verifyingcorrectcableconnection:
WhentheJTAGCableiscorrectlyconnectedtoPCaswellasthetargetboard,it
servesasalinkbetweentheJTAGportoftargetprocessorandthePC.Thislinkisusedby
SPJSCARMsoftwareTools(e.g.DebuggerforARMmicrocontrollers).Thissoftwaretool,
DebuggerwillworkcorrectlyonlywhentheJTAGCableisconnectedcorrectly.
ForSJTS:
ThereisacrudetesttoverifySJTSJTAGCableconnection.Youmaypleasefollowthese
steps:
14

1.ConnectJTAGCablebetweenPCCOMportandEDUARM72148,asperinstructionsin
thismanual.
2.TurnONpowertothetargetboard.
3.OnthePC,runSPJTerminalsoftware.
4.InthePortSettings,selectappropriateCOMport(towhichtheJTAGcableisconnected).
Select115200baud,noparity,8bitsperchar,1stopbitandnoflowcontrol.
5.OpentheCOMPortconnection.
6.TypecharacterGintheterminalwindow.I.e.sendthecharacterGtothePCCOMport.
7.IftheJTAGCableconnectioniscorrect,itwillsendbackcharacter1or0.Asaresult,
youwillseeeither1or0appearingintheterminalwindow.ThisindicatesthatJTAG
Cableconnectionisok.
8.Ifyoudontseeanycharacterintheterminalwindow,probablytheJTAGCableisnot
connectedappropriately.
9.Ifyouseesomecharacterotherthan1and0,theneitherthecableisnotconnected
appropriatelyortheCOMportsettingsarenotasspecifiedabove.

C.HowtoDebugProgram:
1.ConnectSJTSasmentionedabove.
2.OpenprojectinSIDEARM.Rebuildit.
3.Downloadthesamecodeinthetargetboard.
4.InSIDEARMgotoTools>Debugger.
5.InDebuggergotoRun>ClickonNotconnectedtotarget(clickheretoconnect).
6.DeviceIDstartingfrom0x4........willbedisplayedandprogramwillrun.
7.TostopprogramgotoRun>Stop.NowyoucaninsertbreakpointandsayRun.
8.YoucanuseallthefunctionsvisibleinRunoption.
9.Invariablewatchwindowyoucanseeonlyglobalvariables.
10.Ifyouhavedeclaredanyglobalvariablesthenfindtheiraddressesfrom.mapfile.
11.Inserttheseaddressesinvariablewatchwindowandyoucanseeglobalvariablesalso.

15

ExperimentNo.4:
Aim

:WriteaprogramforserialcommunicationusingUART0.W.A.P.totransfer
messageHelloWorld !seriallyat19200baudrate8bitdataand1stopbitusingUART0.

Apparatus :EDUARM2148Trainerkit,SCRAM,PC
Theory

:Writetheoryrelatedtoserialcommunicationusing UART0.

BlockDiagram:
J1
EDUARM72148
PC
SerialCable
Programm:Programisgivenalongwiththecompilersoftware.
SourceCode:
#include<Philips\LPC2148.h>
#include<stdio.h>
voidmain()
{
PINSEL0=0x00000005
InitUart0()
printf("HelloWorld!\n")
while(1)
{
putchar(getchar())
}
}
Function:UART0
#include<Philips\LPC2148.h>
//#include<Philips\LPC2138.h>
#define
VPBDIV
(*((volatileWORD32*)0xE01FC100))
#define
U0RBR
(*((volatileWORD32*)0xE000C000))
#defineDESIRED_BAUDRATE19200
#defineCRYSTAL_FREQUENCY_IN_HZ12000000
#definePCLKCRYSTAL_FREQUENCY_IN_HZ
/*sinceVPBDIV=0x01
*/
#defineDIVISOR(PCLK/(16*DESIRED_BAUDRATE))
voidInitUart0(void)
16

{
/*

/*

U0LCR:UART0LineControlRegister
0x83:enableDivisorLatchaccess,set8bitwordlength,
1stopbit,noparity,disablebreaktransmission
*/
U0LCR=0x83
VPBDIV:VPBbusclockdivider
0x01:PCLK=processorclock
VPBDIV=0x01

*/

/*

U0DLL:UART0DivisorLatch(LSB)
U0DLL=DIVISOR&0xFF

*/

/*

U0DLM:UART0DivisorLatch(MSB)
U0DLM=DIVISOR>>8

*/

/*

U0LCR:UART0LineControlRegister
0x03:sameasabove,butdisableDivisorLatchaccess
U0LCR=0x03

*/

U0FCR:UART0FIFOControlRegister
0x05:ClearTxFIFOandenableRxandTxFIFOs
U0FCR=0x05

*/

/*

}
charputchar(charch)
{
if(ch=='\n')
{
//waituntilTransmitHoldingRegisterisempty
while(!(U0LSR&0x20)){}
//thenstoretoTransmitHoldingRegister
U0THR='\r'
}
//waituntilTransmitHoldingRegisterisempty
while(!(U0LSR&0x20)){}
//thenstoretoTransmitHoldingRegister
U0THR=ch
returnch
}
chargetchar(void)
{
charch
//waituntilthere'sacharactertoberead
while(!(U0LSR&0x01)){}
//thenreadfromtheReceiverBufferRegister
ch=U0RBR
returnch
}
Output:YoucanseeoutputonSPJTerminal.
17

ExperimentNo.5:
Aim

:WriteaprogramtointerfaceLCD.

Apparatus :EDUARM2148Trainerkitwith16x2LCD,SCRAM,PC

Theory

: WritetheoryrelatedtoLDCInterfacingwithARMProcessors.

BlockDiagram:
J1/UART0

J1
[16x2LCD]
EDUARM72148
PC
SerialCable
Programm:Programisgivenalongwiththecompilersoftware.
SourceCode:
#include<Philips\LPC2148.h>
#include"lcd.h"
voidmain()
{
LcdInit()
DisplayRow(1,"JNEC")
DisplayRow(2,"Aurangabad")
while(1)
{}
}
Function:LCD
#include<Philips\LPC2148.h>
#include"lcd.h"
voidSmallDelay(void)
{
inti
for(i=0i<100i++)
}
voidLcdCmd1(unsignedcharcmd)
{
if(cmd&0x01)
IO0SET=(1<<15)
else
IO0CLR=(1<<15)
18

if(cmd&0x02)
IO0SET=(1<<17)
else
IO0CLR=(1<<17)
if(cmd&0x04)
IO0SET=(1<<22)
else
IO0CLR=(1<<22)
if(cmd&0x08)
IO0SET=(1<<30)
else
IO0CLR=(1<<30)
IO1CLR=0x03000000 //makersandenlow
SmallDelay()
IO1SET=0x01000000 //enableen
SmallDelay()
IO1CLR=0x01000000 //disableen
SmallDelay()
}
voidLcdDat1(unsignedchardat)
{
if(dat&0x01)
IO0SET=(1<<15)
else
IO0CLR=(1<<15)
if(dat&0x02)
IO0SET=(1<<17)
else
IO0CLR=(1<<17)
if(dat&0x04)
IO0SET=(1<<22)
else
IO0CLR=(1<<22)
if(dat&0x08)
IO0SET=(1<<30)
else
IO0CLR=(1<<30)
IO1SET=0x02000000 //makeRShigh
SmallDelay()
IO1CLR=0x01000000 //disableen
SmallDelay()
IO1SET=0x01000000 //enableen
SmallDelay()
IO1CLR=0x01000000 //disableen
SmallDelay()
}
voidDelay250(void)
{
intk,j
19

j=200
for(k=0k<100k++)
{
j
}
}
voidDelayMs(intn)
{
intk
for(k=0k<nk++)
{
Delay250()
Delay250()
}
}
voidLcdCmd(unsignedcharcmd)
{
LcdCmd1(cmd>>4)
LcdCmd1(cmd)
Delay250()
Delay250()
}
voidLcdDat(unsignedchardat)
{
LcdDat1(dat>>4)
LcdDat1(dat)
Delay250()
Delay250()
}
voidLcdInit(void)
{
IO1DIR=0x03000000
IO1CLR=0x03000000
IO0DIR=0x40428000
IO0CLR=0x40428000
DelayMs(6)
LcdCmd1(0x03)
DelayMs(6)
LcdCmd1(0x03)
Delay250()
LcdCmd1(0x03)
Delay250()
LcdCmd1(0x02)
Delay250()
LcdCmd(0x28)
LcdCmd(0x08)
LcdCmd(0x0c)
LcdCmd(0x06)
20

}
voidDisplayRow(introw,char*str)
{
/*
passpointerto16characterstring
displayesthemessageonline1orline2ofLCD,dependingonwhetherrowis1or2.
*/
intk
if(row==1)
LcdCmd(0x80)
else
LcdCmd(0xc0)
for(k=0k<16k++)
{
if(str[k])
LcdDat(str[k])
else
break
}
while(k<16)
{
LcdDat('')
k++
}
}

Output:YoucanseethemessageHelloWorldonLCD.Ifrequiredresettheboard.

21

ExperimentNo.6

Aim

:WriteaprogramtoBlinkLEDspresentonEDUARM2148.

Apparatus :EDUARM2148Trainerkit,SCRAM,PC

Theory

: WritetheoryrelatedtoLEDinterfacingusingARM.

BlockDiagram:

J1
[8GeneralPurpose
LEDs]
EDUARM72148

PC
SerialCable

Programs:Programisgivenalongwiththecompilersoftware.
SourceCode:
#include<Philips\LPC2148.h>
#include<stdio.h>
voidmain()
{
PINSEL0=0x00000005
InitUart0()
printf("HelloWorld!\n")
while(1)
{
putchar(getchar())
}
}
Output:YoucanseethemessageHelloWorldonLCD.Ifrequiredresettheboard.

22

ExperimentNo.7
Aim

:Writeaprogramtointerface4*4matrixkeyboard.

Apparatus :EDUARM2148Trainerkit,SCRAM,PC

Theory

: Writetheoryrelatedtointerfacingofmatrixkeypads.

BlockDiagram:

J1
[4x4MatrixKeypad]
EDUARM72148
PC
SerialCable
Programm:Programisgivenalongwiththecompilersoftware.
SourceCode:
#include<Philips\LPC2148.h>
#include<stdio.h>
#include"KBD.h"
#include"UART0.h"
#include"TYPE.h"
#include"lcd.h"
inti8ch
charszTemp[16]
voidmain(void)
{
PINSEL0|=0x00000005
PINSEL1|=0x00000000
UART0_Init()
LcdInit()
DisplayRow(1,"KeypadTest")
DisplayRow(2,"PressAnyKey")
KBD_Init()
{
puts("Thisisakeyboardtestprogram\nPressanykey\nKeycodewillbe
displayed\n")
23

while(1)
{
i8ch=KBD_rdkbd()
printf("Keycode=%02X\n",i8ch)
sprintf(szTemp,"KeyCode=%02X",i8ch)
DisplayRow(2,szTemp)
}
}
}
Function:KBD
#include<Philips\LPC2148.h>
#include"KBD.h"
#include"TYPE.h"
#defineRET0
0x00010000 //P1.16
#defineRET1
0x00020000 //P1.17
#defineRET2
0x00040000 //P1.18
#defineRET3
0x00080000 //P1.19
#define
ALL_RET (RET0|RET1|RET2|RET3)
#defineSCAN0
0x00100000 //P1.20
#defineSCAN1
0x00200000 //P1.21
#defineSCAN2
0x00400000 //P1.22
#defineSCAN3
0x00800000 //P1.23
constuint32KBD_u32scanport1[4]={SCAN0,SCAN1,SCAN2,SCAN3}
constuint32KBD_u32retport[4]={RET0,RET1,RET2,RET3}
#defineCRYSTAL_FREQUENCY_IN_HZ12000000
#definePLL_MULTIPLIER 1
#defineDEL_LOOPS
CRYSTAL_FREQUENCY_IN_HZ*PLL_MULTIPLIER/500000
int32KBD_i32keydown
voidKBD_cdelay(void)
{
int32i32i
for(i32i=0i32i<5*DEL_LOOPSi32i++){}
}
voidKBD_Init(void)
{
//IO1DIR&=(0xFFFFFFFF^(RET0|RET1|RET2|RET3))
//printf("IO1PIN%02bx\n",IO1PIN)
KBD_i32keydown=1
}
int32KBD_i32the_sc
int32KBD_kbhit(void)
{
24

int32i32sc,i32sc0
int32i32ret,i32ret0
for(i32sc=0i32sc<4i32sc++)
{
IO1DIR=KBD_u32scanport1[i32sc]|(0x03000000) //ForRSandRWofLCD
IO1CLR=KBD_u32scanport1[i32sc]
KBD_cdelay()
i32ret=IO1PIN&ALL_RET
if(KBD_i32keydown==1)
{
switch(i32ret)
{
case (ALL_RET&(~RET0))
:
KBD_i32the_sc=i32sc
KBD_i32keydown=(i32sc*4)
//printf("RET0")
//printf("%u\n",i32sc)
return1
case (ALL_RET&(~RET1))
:
KBD_i32the_sc=i32sc
KBD_i32keydown=(i32sc*4)+1
//printf("RET1")
//printf("%u\n",i32sc)
return1
case (ALL_RET&(~RET2))
:
KBD_i32the_sc=i32sc
KBD_i32keydown=(i32sc*4)+2
//printf("RET2")
//printf("%u\n",i32sc)
return1
case (ALL_RET&(~RET3))
:
KBD_i32the_sc=i32sc
KBD_i32keydown=(i32sc*4)+3
//printf("RET3")
//printf("%u \n",i32sc)
return1
}
}
else
{
//i.e.keyisalreadypressed,waituntilitisreleased
if(i32sc==KBD_i32the_sc)
{
if(i32ret==ALL_RET)
{
KBD_i32keydown=1 //keyhasbeenreleased
25

}
}
}
}
return0
}
int32KBD_rdkbd(void)
{
while(!KBD_kbhit()){}
returnKBD_i32keydown
}
Function:LCD
#include<Philips\LPC2148.h>
#include"lcd.h"
voidSmallDelay(void)
{
inti
for(i=0i<100i++)
}
voidLcdCmd1(unsignedcharcmd)
{
if(cmd&0x01)
IO0SET=(1<<15)
else
IO0CLR=(1<<15)
if(cmd&0x02)
IO0SET=(1<<17)
else
IO0CLR=(1<<17)
if(cmd&0x04)
IO0SET=(1<<22)
else
IO0CLR=(1<<22)
if(cmd&0x08)
IO0SET=(1<<30)
else
IO0CLR=(1<<30)
IO1CLR=0x03000000 //makersandenlow
SmallDelay()
IO1SET=0x01000000 //enableen
SmallDelay()
IO1CLR=0x01000000 //disableen
SmallDelay()
}

26

voidLcdDat1(unsignedchardat)
{
if(dat&0x01)
IO0SET=(1<<15)
else
IO0CLR=(1<<15)
if(dat&0x02)
IO0SET=(1<<17)
else
IO0CLR=(1<<17)
if(dat&0x04)
IO0SET=(1<<22)
else
IO0CLR=(1<<22)
if(dat&0x08)
IO0SET=(1<<30)
else
IO0CLR=(1<<30)
IO1SET=0x02000000
SmallDelay()
IO1CLR=0x01000000
SmallDelay()
IO1SET=0x01000000
SmallDelay()
IO1CLR=0x01000000
SmallDelay()

//makeRShigh
//disableen
//enableen
//disableen

}
voidDelay250(void)
{
intk,j
j=200
for(k=0k<100k++)
{
j
}
}
voidDelayMs(intn)
{
intk
for(k=0k<nk++)
{
Delay250()
Delay250()
}
}
voidLcdCmd(unsignedcharcmd)
{
LcdCmd1(cmd>>4)
27

LcdCmd1(cmd)
Delay250()
Delay250()
}
voidLcdDat(unsignedchardat)
{
LcdDat1(dat>>4)
LcdDat1(dat)
Delay250()
Delay250()
}
voidLcdInit(void)
{
IO1DIR|=0x03000000
IO1CLR|=0x03000000
IO0DIR|=0x40428000
IO0CLR|=0x40428000
DelayMs(6)
LcdCmd1(0x03)
DelayMs(6)
LcdCmd1(0x03)
Delay250()
LcdCmd1(0x03)
Delay250()
LcdCmd1(0x02)
Delay250()
LcdCmd(0x28)
LcdCmd(0x08)
LcdCmd(0x0c)
LcdCmd(0x06)
}
voidDisplayRow(introw,char*str)
{
/*
passpointerto16characterstring
displayesthemessageonline1orline2ofLCD,dependingonwhetherrowis1or2.
*/
intk
if(row==1)
LcdCmd(0x80)
else
LcdCmd(0xc0)
for(k=0k<16k++)
{
if(str[k])
LcdDat(str[k])
else
break
28

}
while(k<16)
{
LcdDat('')
k++
}
}

Output:Inthisprogramafterpressingany,itscodeissendtoserialportusingUART0.You
canseeoutputonbSPJTterminal.

29

ExperimentNo.8

Aim

:WriteaprogramtointerfaceSteppermotor.

Apparatus :EDUARM2148withsteppermotorTrainerkit,SCRAM,PC

Theory

: Writetheoryrelatedtosteppermotorinterfacing.

BlockDiagram:

X
J1
[StepperMotor 5
Drive]
EDUARM72148

PC
SerialCable

Programm:Programisgivenalongwiththecompilersoftware.
SourceCode:
#include<Philips\LPC2148.h>
#definePHASEA0x00002400
#definePHASEB0x00001400
#definePHASEC0x00001800
#definePHASED0x00002800
unsignedintdelay
voidmain()
{
PINSEL0=0x00000000
PINSEL1=0x00000000
IO0DIR=0x003C3C00
IO0SET=0x003C0000
//PINSEL2=0x00000000
//IO1DIR=0x00000000
while(1)
{
IO0SET=PHASEA
IO0CLR=(~PHASEA)&0x00003C00
for(delay=0delay<30000delay++)
IO0SET=PHASEB
IO0CLR=(~PHASEB)&0x00003C00
30

for(delay=0delay<30000delay++)
IO0SET=PHASEC
IO0CLR=(~PHASEC)&0x00003C00
for(delay=0delay<30000delay++)
IO0SET=PHASED
IO0CLR=(~PHASED)&0x00003C00
for(delay=0delay<30000delay++)
}
}

Output:Youcanseesteppermotormovinginparticulardirectionandcorrespondingphase
changesyoucanobservedLEDsD9D12.

31

ExperimentNo.9

Aim

:Writeaprogram forinterfacingofLM35temperaturesensortoonchip
ADC(ADC0.Channel2,P0.29)

apparatus :EDUARM2148Trainerkit,SCRAM,PC

Theory

: Writetheoryrelatedtointerfacingofsensors.

BlockDiagram:
J1
[AnalogInput]
EDUARM72148

PC
SerialCable

Programm:Programisgivenalongwiththecompilersoftware.
SourceCode:
#include<Philips\LPC2138.h>
#include<stdio.h>
#include"TYPE.h"
#include"uart0.h"
voidADC_Init(void)
{
PINSEL1=0x04000000 //P0.29,AD0.2
}
unsignedintADC_GetAdcReading(uint32u32ChnlNum)
{
AD0CR=0x01200300+(1<<u32ChnlNum)
while(!((u32ChnlNum=AD0DR)&0x80000000))
{
}
return((u32ChnlNum>>6)&0x3ff)
}
intmain(void)
{
uint32u32k=2
UART0_Init()
ADC_Init()
32

while(1)
{
printf("Pressanykeytogetchannel2reading...\n")
getchar()
if(u32k)
{
printf("Chnl%d:0x%03X\n",u32k,ADC_GetAdcReading(u32k))
}
}
return0
}
Function:UART0
#include<Philips\LPC2148.h>
#include"TYPE.h"
#defineDESIRED_BAUDRATE19200
#defineCRYSTAL_FREQUENCY_IN_HZ12000000
#definePCLKCRYSTAL_FREQUENCY_IN_HZ
//sinceVPBDIV=0x01
#defineDIVISOR(PCLK/(16*DESIRED_BAUDRATE))
voidUART0_Init(void)
{
PINSEL0|=0x00000005
/*
U0LCR:UART0LineControlRegister
0x83:enableDivisorLatchaccess,set8bitwordlength,
1stopbit,noparity,disablebreaktransmission
*/
U0LCR=0x83
/*
VPBDIV:VPBbusclockdivider
0x01:PCLK=processorclock
*/
VPBDIV=0x01
/*
U0DLL:UART0DivisorLatch(LSB)
*/
U0DLL=DIVISOR&0xFF
/*
U0DLM:UART0DivisorLatch(MSB) */
U0DLM=DIVISOR>>8
/*
U0LCR:UART0LineControlRegister
0x03:sameasabove,butdisableDivisorLatchaccess
U0LCR=0x03
/*
U0FCR:UART0FIFOControlRegister
0x05:ClearTxFIFOandenableRxandTxFIFOs
U0FCR=0x05
}
int8putchar(int8i8ch)
{
if(i8ch=='\n')
{
//waituntilTransmitHoldingRegisterisempty
while(!(U0LSR&0x20)){}
//thenstoretoTransmitHoldingRegister
U0THR='\r'
}

*/

*/

33

//waituntilTransmitHoldingRegisterisempty
while(!(U0LSR&0x20)){}
//thenstoretoTransmitHoldingRegister
U0THR=i8ch
returni8ch
}
int8getchar(void)
{
int8i8ch
//waituntilthere'sacharactertoberead
while(!(U0LSR&0x01)){}
//thenreadfromtheReceiverBufferRegister
i8ch=U0RBR
returni8ch
}

Output:youcanseedigitalreadingofthecorrespondinganaloginputfromLM35onSPJterminal.

34

ExperimentNo.10
Aim

:WriteaprogramtogenerateRAMPwaveusingonchipDAC(P0.25)

apparatus :EDUARM2148Trainerkit,SCRAM,PC,Oscilloscope

Theory

: WritetheoryrelatedtoDAC.

BlockDiagram:
X
J1
[StepperMotor 5
Drive]
EDUARM72148

PC
SerialCable

Programm:Programisgivenalongwiththecompilersoftware.
SourceCode:
#include<Philips\LPC2148.h>
#define
DACR
(*((volatileWORD32*)0xE006C000))
#include"UART0.h"
#include"LCD.h"
#include<stdio.h>
unsignedintg_uiAoutValue=0
intmain(void)
{
PINSEL0=0x55
PINSEL1=0x00080000 //touseP0.25asDACoutputpin.
InitUart0()
LcdInit()
DisplayRow(1,"DAC/MiniARM2148")
DisplayRow(2,"spjsystems.com")
puts("DACexampleprogramby:\n\n\nwww.spjsystems.com\n\n\nRunsonMiniARM
2148Evaluationboard\nGeneratesaramp\n")
for()
{
for(g_uiAoutValue=0g_uiAoutValue<1024g_uiAoutValue++)
{
DACR=g_uiAoutValue<<6
}
}
}
Output:youcanseeRampwaveonoscilloscope.
35

ExperimentNo.11

Aim

:WriteaprogramtointerfaceAT25256EEpromusingSPIprotocol.

Apparatus :EDUARM2148Trainerkit,SCRAM,PC

Theory

: WritetheoryrelatedtoSPIProtocol.

BlockDiagram:
J1

PC

[SPI]
EDUARM72148

SerialCable
Programm:Programisgivenalongwiththecompilersoftware.
SourceCode:
#include<Philips\LPC2148.h>
#include<Stdio.h>
#include"Type.h"
#include"UART0.h"
#include"TIMER.h"
#include"SPI.h"
/***************************************************
Mainfunction.
****************************************************
*/
voidmain(void)
{
uint8u8buffer1[20]={'H','E','L','L','O',0}
uint8u8buffer2[20]
UART0_Init()
SPI_Init()
TIMER_Init()
printf("Initdone.")
while(1)
{
if(!SPI_WriteToSPIEEPROM(0,u8buffer1,6))
printf("\nMemorywriteerror.")
if(!SPI_ReadFromSPIEEPROM(0,u8buffer2,6))
36

printf("\nMemoryReaderror..")
printf("\nData:%s",u8buffer2)
}
}
Function:Timer
#include<Philips\LPC2148.h>
#include"Type.h"
#include"Timer.h"
/**************************************************
Timer0isusedfordelayinmicrosec
Timer1isusedfortimeoutdelay
Timerisinitializedtosimplycountataspecified
frequency(Configuration.h).
CountcanbereadfromregisterTC.
***************************************************
*/
/*
Initialisesthetimers
*/
voidTIMER_Init(void)
{
//PowerONtimerperipheral
PCONP
|=0x00000006
//TPC:TimerPrescalercounter
//thecounterisincrementedonceeveryTPC+1cyclesofPCLK
T0PR =PRESCALER0
//T1PR
=PRESCALER1
//TCR:TimerControlRegister
//2:resetcounters(bothtimerandprescaler)
//1:enablecounting
T0TCR=2
//T1TCR=2
}
/*
waitsfornexttickintimer
*/
voidTIMER_WaitForNextTick(void)
{
uint32start=T0TC
while(T0TC==start){}
//waituntiltimercounterchanges,thenleave
}
Function:SPI
#include<Philips\LPC2148.h>
#include<Stdio.h>
#include"Type.h"
#include"UART0.h"
37

#include"TIMER.h"
#include"SPI.h"
/***************************************************
ContainsallSPIrelatedfunctions.
ForInterfacingSPI0isused.
****************************************************
*/
/*
InitialisestheSPIprotocolandportpins.
*/
voidSPI_Init(void)
{
//PoweronSPI0peripheral
PCONP
|=0x00000100
//DefineportpinasSCL0,MISO0andMOSI0
PINSEL0
|=0x00001500
//Set#CSpin
Set_SPI_CS0_AS_OP()
Set_SPI_CS0()
//SetSPIclockspeed.
S0SPCCR =SPI_EEPROM_SPEED_DIVISOR&0xFE
//Operatesinmastermode
S0SPCR=0x00000020
}
/*
ReadsdatafromSPIEEPROM.
Lengthshouldbe>0.
Return:
Trueonvaliddataand
Falseontimeoutoranyerrorwithdevice
*/
BOOLSPI_ReadFromSPIEEPROM(uint32u32startAddr,uint8*u8ptr2arr,uint32u32len)
{
uint32u32i
uint32u32dummyData
//Checkforupperlimit
if((u32startAddr+u32len>=SPIEEPROM_SIZE)||(u32len==0))
returnFALSE
//Selectdevice
Clr_SPI_CS0()
//SendReadopcode
S0SPDR=CMD_SPIEEPROM_READ
while(!(S0SPSR&0x80))
u32dummyData=S0SPDR
//Sendstartaddress
S0SPDR=(u32startAddr>>8)&0xFF
while(!(S0SPSR&0x80))
u32dummyData=S0SPDR
S0SPDR=u32startAddr&0xFF
while(!(S0SPSR&0x80))
38

u32dummyData=S0SPDR
//Readbytewise
for(u32i=0u32i<u32lenu32i++)
{
S0SPDR=0//Dummywrite
while(!(S0SPSR&0x80))
//Readdata
u8ptr2arr[u32i]=S0SPDR
}
//Deselectdevice
Set_SPI_CS0()
returnTRUE
}
/*
WritesdatatoSPIEEPROM.
Lengthshouldbe>0.
Return:
Trueonsuccessfulwriteand
Falseontimeoutoranyerrorwithdevice
*/
BOOLSPI_WriteToSPIEEPROM(uint32u32startAddr,uint8*u8ptr2arr,uint32u32len)
{
uint32u32i
uint32u32dummyData
//Checkforupperlimit
if((u32startAddr+u32len>=SPIEEPROM_SIZE)||(u32len==0))
returnFALSE
//writedatabytewise
for(u32i=0u32i<u32lenu32i++)
{
//Writeenabledevice
Clr_SPI_CS0()
//SendWriteEnableopcode
S0SPDR=CMD_SPIEEPROM_WREN
while(!(S0SPSR&0x80))
u32dummyData=S0SPDR
Set_SPI_CS0()
//Selectdevice
Clr_SPI_CS0()
//SendWriteopcode
S0SPDR=CMD_SPIEEPROM_WRITE
while(!(S0SPSR&0x80))
u32dummyData=S0SPDR
//Sendstartaddress
S0SPDR=(u32startAddr>>8)&0xFF
while(!(S0SPSR&0x80))
u32dummyData=S0SPDR
S0SPDR=u32startAddr&0xFF
while(!(S0SPSR&0x80))
39

u32dummyData=S0SPDR
u32startAddr++
//Senddata
S0SPDR=u8ptr2arr[u32i]
while(!(S0SPSR&0x80))
u32dummyData=S0SPDR
Set_SPI_CS0()
//Waitforwritingiscomplete
if(!SPI_WaitForEEPROMReady())
returnFALSE
}
returnTRUE
}
/*
Waitsuntilbyteprogramisdone.
Return:
TrueonEEPROMisreadywithwritedoneandFalseontimeout
*/
BOOLSPI_WaitForEEPROMReady(void)
{
uint32u32dummyData
TIMER0_RESET()
TIMER0_ENABLE()
while(T0TC<SPIEEPROM_WRITE_TIME_OUT)
{
//Pollforreadybit
Clr_SPI_CS0()
S0SPDR=CMD_SPIEEPROM_RDSR
while(!(S0SPSR&0x80))
u32dummyData=S0SPDR
S0SPDR=0
while(!(S0SPSR&0x80))
if(!(S0SPDR&0x01))
{
Set_SPI_CS0()
TIMER0_DISABLE()
returnTRUE
}
Set_SPI_CS0()
}
#ifdefDEBUG
printf("Timedout..WaitForEEPROMReady")
#endif
TIMER0_DISABLE()
returnFALSE
}

Output:youcanseeoutputonSPJterminal.
40

4.Quizonthesubject
1. Writeshortnoteson:
a. PriorityScheduling
b. Multitasking
c. Seamthort
5. ConductionofVivaVoceExamination:
Teachershouldconductoralexamsofstudentwithfullpreparation.Normallythe
objectivequestionswithguessesaretobeavoided.Tomakeitmeaningful,the
questionsshouldbesuchthatdepthofthestudentsinthesubjectistested.Oral
examinationsaretobeconductedincordialenvironmentamongsttheteachertaking
theexamination.Teacherstakingsuchexaminationsshouldnothaveillthoughts
abouteachotherandcourtesiesshouldbeofferedtoeachotherincaseofdifference
ofopinion,whichshouldbecriticallysuppressedinfrontofthestudents.
6. EvaluationandMarkingsystems:
Basichonestyintheevaluationandmarkingsystemisabsolutelyessentialandinthe
processimpartialnatureoftheevaluatorisrequiredintheexaminationsystemto
becomesuccessful.Itiswrongapproachorconcepttoawardthestudentsbywayof
easymakingtogetcheappopularityamongthestudentswhichtheydonotdeserve.
Itisaprimaryresponsibilityoftheteachertoseethatrightstudentsarereallyputting
uplotofhardworkwithrightkindofintelligencearecorrectlyawarded.
Themarkingpatternshouldbejustifiabletothestudentswithoutanyambiguityand
teachershouldseethatthestudentsarefacedwithjustcircumstances.

41

S-ar putea să vă placă și