![]() ![]() For example, some of the pins of PORTB are also multiplexed with ADC channels. Some pins of PIC18F46K22 microcontroller has multiple functions. When we use TRISB1_bit it sets only B1 pin as an output. ![]() When we use TRISB it is going to set whole port B i.e. ![]() TRISx = 0x00 //in hex format 0x00 means all bits of TRIS register 0 and as a output For example, if we want to configure any PORT as a digital input pin, we set TRIS register value to ‘1’ and if we want to use as a digital output pin, we set TRIS register as logic ‘0’. We will discuss all of them one by one.TRIS register determines whether a port pin is an input or output pin. In order to use any pin of PIC18F46k22 as a digital output, We need to set different registers to get this project work. How to use GPIO pins of Pic Microcontroller For further information on microcontroller GPIO pins, you can read this post: In this example, we will use GPIO pins of PIC18F46K22 microcontroller as a digital output. As you know that all microcontroller has GPIO pins that can be used either as digital input or digital output pins. For demonstration, we will write our first program to turn a LED ON and OFF connected to the PIC18F46K22 microcontroller. Now that you know how to create a new project by selecting a specific microcontroller. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |