Documents

Document 1.rtf

Description
Next step is writing the program. All the information about writing programs which include its commands, operations and the microcontroller registers are available on the datasheet and Hi- Tech Toolsuite guide. But I will also tr to ma!e ou understand the first steps so that the datasheet and guide ma prove useful. ou can start ma!ing our own programs at the end of this tutorial. Now let us view a program for #$%&''A where & ()* are connected at the +,-T B .& pins of port B, from pin no //
Categories
Published
of 2
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
  Next step is writing the program. All the information about writing programs which include its commands, operations and the microcontroller registers are available on the datasheet and Hi-Tech Toolsuite guide. But I will also tr to ma!e ou understand the first steps so that the datasheet and guide ma prove useful. ou can start ma!ing our own programs at the end of this tutorial.Now let us view a program for #$%&''A where & ()* are connected at the +T B & pins of port B, from pin no //-012. This programs blin!s the ()*s which means the ()*s remain on for asecond and off for another second.Hi-Tech 3 3ode4include 5htc.h64define 78TA(7%)9 &111111void main2: TI;B<1811= +TB<1811= while#2 : +TB<18%%= 7dela7ms#112= +TB<1811= 7dela7ms#112= >>This is the core stle of writing the microcontroller program. As ou can see, the stle is completel similar to that of the normal 3 programs. ?ust some additional !ewords here. emember that all the sntax and mathematical and logical operations supported b stdio and conio libraries are accepted here in htc librar with some additional ones also. In the first line, we start the program b including the librar. This step is nothing new. Now we need to define the fre@uenc of oscillator used in the sstem. This is the stle of defining the oscillator fre@uenc. The value &111111 means its fre@uenc is &H. ;tart of the main program code TI; is the command used for initialiing the ports of the microcontroller. TI;B is an & bit register, in fact ever word written in capital represents a register inside the microcontroller and ou can get all the information about the register in the datasheet. Csing this line will start the useof +T B and if the value is D#E in the respective register bit, that pin will be made input and if thevalue is D1E, the pin will be made output. ne more thing, the use of D1xE in that line represents thatwe are giving the data in hexadecimal number sstem. ou can use D1bE if ou wish to give the data in binar and use nothing if ou use decimal number sstem. ;o this line ma!es each & linesof port B output. ther wa to give the same command isF TI;B<1= decimal2 and TI;B<1b11111111= binar2. +TB is also a register li!e TI;B. This register passes the value out of port B. This means +TB<1x11 will give low output from each eight line of port B. This is e@uivalent to clearing of port B at the start from an stra values. This line is not needed because there are no stra values at the start. ;tart of while loop. Ge write the entire program inside the while loop. After all initialiations have been done, the main code is written here. This is done because this segment of program has to repeat over and over but the initialiations do not need to be repeated. That is wh the main program is written inside the while loop. +TB is also a register li!e TI;B. This register passes the value out of port B. This means +TB<1xff will give high output from each eight line of port B. This line is written to have a dela of #111ms. ;o high logic will pass from port B pins for 11ms. This line will ma!e the output from port B get down to 1, ie logic D1E. It is to be considered that  until the value in +TB or an other port register is changed, the output from the corresponding port will also not change. ;o the output will drop from  logic #2 to 1 logic 12 onl when this line is executed. Again a dela of #111ms. )nd

anadel

Jul 22, 2017
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks
SAVE OUR EARTH

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!

x