Skip to main content

Posts

Showing posts with the label Microcontroller

Digital Voltmeter using PIC Microcontroller

This is a simple voltmeter which measures 0-5V at a precision of 4.8 mV. This is a simple design using inbuilt ADC of PIC 16F877A. PIC 16F877A have 8 channel 10bit ADC.   Measured voltage is displayed on 16x2 LCD display. Using one of the most popular 8 bit PIC 16f877A, for instance, reading the datasheet , we'll find that the ADC modules (10 bit) are controlled by four different registers. The first two, ADCON0 and ADCON1 , are used to set and start the ADC module. When high level language is used, the programmer doesn't need to care a lot of the register connected to the results because they are normally stored in a variable by a routine of the language itself ( adc_read , for instance, using mikroc). The ADCON0 As we can see this registers are 8 bit registers where. - bit6 and bit 7 are used to set the frequency of the conversions. - bits 3, 4 and 5 are used to select the pins of the microcontroller enabled to theadc conversions. - bit 2 represents the sta...

Interrupt of PIC 16F877A

Interrupt of PIC 16F877A Features of the external interrupt that we will use. The interrupt is triggered by an input on RB0, either ( depending on how we set it up ) as the signal goes from 0 to 1, called the rising edge, or as the signal goes from 1 to 0, called the falling edge. This sets the interrupt flag, and if the interrupt is enabled ( and we are not already in an interrupt ) the microcontroller goes to the interrupt subroutine. The use of the RB0/Int to manage interrupt externally generated requires the setting of a couple of registers of the picmicro: INTCON  and OPTION_REG      It should be clear that the use of RB0/Int function of a picmicro requires the setting of the: GIE (7): set to 1 to enable global interrupts INTE (4): set to 1 to enable interrupts on pin RB0 PEIE (6): to disable other periferal interrupts and the set of the INTEDG bit(6) of the OPTION_REG register simply to select the...