This is equivalent to clearing of port B at the start from any stray values.Well it is a bit difficult to start learning microcontrollers.And the guides and tutorials also do not start from zero level which makes learning far more difficult than anticipated.
All you need is the simplest knowledge of electronics or digital circuits. But you surely should have a decent knowledge of C language. 16F628A Simple Program Software And IDEMPLAB is the name of the software and IDE stands for Integrated Development Environment. IDE means that the software itself has all or most of the features that is needed. 16F628A Simple Program Code Depends UponWe can write programs for the PIC microcontrollers in MPLAB but the syntax and code depends upon the library, which may be different from family to family and even a lot of libraries are available for the same family of microcontrollers too. 16F628A Simple Program Series 16F WhichIt is used for programming the microcontrollers of series 16F which will be enough for the beginner users. ![]() But as the 16F series microcontrollers are 8 bit and support clock rates up to 20 MHz, they are useful in most of our non-commercial applications. The software MPLAB IDE comes with integrated HTC compiler library from the version 8.56 on wards. 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 try to make you understand the first steps so that the datasheet and guide may prove useful. You can start making your own programs at the end of this tutorial. Now let us view a program for 16F877A where 8 LED are connected at the PORT B (8 pins of port B, from pin no 33-40). This programs blinks the LEDs which means the LEDs remain on for a second and off for another second. As you can see, the style is completely similar to that of the normal C programs. Just some additional keywords here. Remember that all the syntax and mathematical and logical operations supported by stdio and conio libraries are accepted here in htc library with some additional ones also. TRISB is an 8 bit register, in fact every word written in capital represents a register inside the microcontroller and you can get all the information about the register in the datasheet. Using this line will start the use of PORT B and if the value is 1 in the respective register bit, that pin will be made input and if the value is 0, the pin will be made output. One more thing, the use of 0x in that line represents that we are giving the data in hexadecimal number system. You can use 0b if you wish to give the data in binary and use nothing if you use decimal number system. Other way to give the same command is: TRISB0; (decimal) and TRISB0b00000000; (binary). This means PORTB0x00 will give low output from each eight line of port B.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |