Design a circuit using PIC 18F458, which counts the number of input pluses read
ID: 2291492 • Letter: D
Question
Design a circuit using PIC 18F458, which counts the number of input pluses read by any input I/O port of the PIC 18 and show the pulses counting state on the 7-segment display. Hint: For Input pulses function generator or 555 Astable oscillator can be used. Design a circuit using PIC 18F458, which counts the number of input pluses read by any input I/O port of the PIC 18 and show the pulses counting state on the 7-segment display. Hint: For Input pulses function generator or 555 Astable oscillator can be used. Design a circuit using PIC 18F458, which counts the number of input pluses read by any input I/O port of the PIC 18 and show the pulses counting state on the 7-segment display. Hint: For Input pulses function generator or 555 Astable oscillator can be used.Explanation / Answer
Coding for the designing of 7 segment display in pic18f458 is provided by me, which will give your the required results easily. -
Data lines for all SSD's are common. and they are connected to PORTD.
To select particular SSD of that Bank we have used another latch(latch 6) connected to PORTE = E0 bit
if I want to select SSD no. 2 and SSD no 10 then steps needed are as follows
PORTA - A1 =1 //Enable bank 1
PORTD - D6 = 0 //Select SSD 2 by making D6 bit low.
PORTE - E0 = 1 //Enable PORTE to load value of PORTD(in this case D6) and select that SSD.
PORTD= 0xFF // Send character FF to SSD 2
PORTA - A2=1 //Enable bank 2
PORTD - D5 = 0 // Select SSD 10 by making D5 pin low
PORTE - E0 = 1 //Enable PORTE to load value of PORTD(in this case D5) and select that SSD.
PORTD - D = 0xFE // Send Character FE to SSD 10.
code for the same :-
#include <p18f4550.h>
#pragma config FOSC = HS // 20MHz Crystal, (HS oscillator)
#pragma config PBADEN = OFF // PORTB<4:0> pins are configured as digital I/O on Reset)
#pragma config WDT = OFF // watch dog timer off
#pragma config LVP = OFF // Low voltage program off
void main()
{
ADCON1 = 0xFF; // Configure all ports with analog function as digital
CMCON = 7;
TRISD=0; //make PORTD all out put
TRISB=0xf0; //make PORTB pins 0:4 o/p and others input( we need only 0:4 pins)
TRISA=0;
TRISE=0;
while(1)
{
PORTA=0x02; //Enable bank_1
PORTD=0xBF; //Select SSD 2 by making D6 bit low.
PORTE=0x01; //Enable PORTE to load value of PORTD(in this case D6) and select that SSD.
PORTE=0x00; //Disable PORT E so that character data won't go in SSD Select latch, i.e=PORTE - E0 bit.
PORTD= 0xFF // Send character FF to SSD 2
PORTA=0x04; //Enable bank_2
PORTD=0xDF; // Select SSD 10 by making D5 pin low
PORTE=0x01; //Enable PORTE to load value of PORTD(in this case D5) and select that SSD.
PORTE=0x00; //Disable PORT E so that character data won't go in SSD Select latch, i.e=PORTE - E0 bit.
PORTD=0xFE; // Send Character FE to SSD 10.
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.