Skip to main content

Turn off Led using PIC16f877a with Assembler Code


Start making a simple program in which we in assembly code using PIC 16F877A to turn on and off an LED by pressing a button as shown in the diagram.
We will use two ports of the PIC 16F877A, port B and port D, declare the B port as input and the D port will be configured as an output. In the graph we can see that the pin RB0 is set button and a resistor in a pull-up configuration, when you are not pressing the button it gets a high (5V) to the RB0 input and when pressed he gets a level low (0V). In the output RD0 to turn on the led its output should be at a low level so when developing the program in assembler we test the pin B0 and if a high level put a high value on the output RD0 that will keep off LED, otherwise put a low value on the output RD0 which will cause the LED lights.

ASSEMBLER PROGRAM FOR PIC 16F877A
To make the program use the MPLABX 2.0
Open the IDE MPLABX program.
  • We click file, select New Project ...
  • In window "Select Project" emerging select "Microchip Embedded" and "Standalone Project" then click on "next".
  • In the window that pops up "Select Device" leave the box "Family" in "all families" and the box "Device" digitamos "PIC16F877A" then press "next".
  • In the "Select Tool" window select "Simulator" and we click "Next".
  • In "Select compiler" select "MPASM (v5.54) [...... ..".
  • Now select the location and name of the project.
  • After creating the project and select New File window "Select File Type" appears and select "assembler" if not listed select "Other" a new list where you can select "assembler" appears.
  • Then you can put nonbre to File and select a folder within the project and ready.
Now it's time to write the program in assembler that is recorded in the pic 16F877A is as follows:

Comments

Popular posts from this blog

Electronic Extended Play Circuit Diagram

This is a Electronic Extended Play Circuit Diagram. A single op amp-one of four contained in the popular LM324-is operating in a variable pulse width, free-running square wave oscillator circuit, with its timed output driving two transistors that control the on/ off cycle of the tape-drive motor. The Oscillator` s positive feedback path holds the secret to the successful operation of the variable on/ off timing signal.   Electronic Extended Play Circuit Diagram The two diodes and pulse width potentiometer R8 allows the setting of the on and off time, without affecting the oscillator`s operating frequency. One diode allows only the discharge current to flow through it and the section of R8 that it`s connected to. The other diode, and its portion of R8, sets the charge time for the timing capacitor, C3. Since the recorder`s speed is controlled by the precise off/on timing of the oscillator, a simple voltage-regulator circuit (Ql, R3, and D4) is included.  Connecting the spe...

Power Amplifier with voltage regulator 4 × 50 Watt TDA8588

Power Amplifier with voltage regulator 4 × 50 Watt TDA8588    The TDA8588 is a multiple voltage regulator combined with four independent audio power amplifiers configured in bridge tied load with diagnostic capability. The output voltages of all regulators except regulators 2 and 3 can be controlled via the I2C-bus. However, regulator 3 can be set to 0 V via the I2C-bus. The output voltage of regulator 2 (microcontroller supply) and the maximum output voltage of regulator 3 (mechanical digital and microcontroller supplies) can both be either 5 V or 3.3 V depending on the type number. The maximum output voltages of both regulators are fixed to avoid any risk of damaging the microcontroller that may occur during a disturbance of the I 2C-bus. The amplifier diagnostic functions give information about output offset, load, or short-circuit. Diagnostic functions are controlled via the I2C-bus. The TDA8588 is protected against short-circuit, over-temperature, open ground and open VP ...

Digital Voltmeter Circuit with ICL7107

Description. The circuit given here is of a very useful and accurate digital voltmeter with LED display using the ICL7107 from Intersil. The ICL7107 is a high performance, low power, 3.5 digit analog to digital converter. The IC includes internal circuitry for seven segment decoders, display drivers, reference voltage source and a clock. The power dissipation is less than 10mW and the display stability is very high. The working of this electronic circuit is very simple. The voltage to be measured is converted into a digital equivalent by the ADC inside the IC and then this digital equivalent is decoded to the seven segment format and then displayed. The ADC used in ICL7107 is dual slope type ADC. The process taking place inside our ADC can be stated as follows. For a fixed period of time the voltage to be measured is integrated to obtain a ramp at the output of the integrator. Then a known reference voltage of opposite polarity is applied to the input of the integrator and allowed to r...