Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Electrical & Electronics Expert

Aim:

The aim of this practical is to work with multiplexed 7-segment displays and implement a counter and display the 7- segment on the PIC trainer.

Equipment:

  • PIC Trainer and PICkit3 in-circuit debugger
  • PIC 7-segment display board
  • MPLAB Integrated Development Environment software

 

Table

Digit

7 seg code

Hex Code

 

dp

g

f

e

d

c

b

a

0

0

1

1

1

1

1

1

0

0

0

0

0

1

1

0

0

1

0

1

1

0

1

1

0

1

0

0

1

1

1

1

0

1

1

0

0

1

1

0

0

1

1

0

1

1

0

1

0

1

1

1

1

1

0

1

0

0

0

0

0

1

1

1

0

1

1

1

1

1

1

1

0

1

1

0

0

1

1

1

0

1

1

1

0

1

1

1

0

1

1

1

1

1

0

0

0

0

1

1

1

0

0

1

0

1

0

1

0

1

1

1

0

1

1

1

1

0

0

1

0

1

1

1

0

0

0

1

 

 

0

3F

1

0x06

2

0x5B

3

0x4F

4

0x66

5

0x6D

6

0x7D

7

0x07

8

0x7F

9

0x67

A

0x77

B

0x7c

C

0x39

D

0x5E

E

0x79

F

0x71

 

Procedure:

In the beginning of the program, it is expected that the program displays one digit on the LCD with configuring of PortB , Port C and Port D and send the result to port D to be display.

The bit 1 of port C was set to active the PortC1 to display the number on the LSB digit and an appropriate value was written to port D. In order to control the 7-segment display an appropriate value was written to Port D.

The reset vector was defined and the program was directed to the START of the program to call the initialization to set the port B as an input by setting the TRISB and then make the port C and D as an output by clearing their TRISs. The program then will return in order to move the binary value (b'0111111') into the W register to be assigned to TRISB for an input.

The program then was given a subroutine name " again"to branch back and continue this cycle in order to show the digits accordingly.

After the program was started the program shows a digit number 0 on the right hand side display because the program turns on the segment a to f but not g as the table above shows.

Single digit counter:

The aim of this step was to write a subroutine hex_7seg to turn on the right hand display and shows the required number.

The program was accomplished in this step by continuing the instructions in the previous step and extending them such that after the program was branched to START and moving the binary value into the WREG as well as the value of port B and clearing the ports C and D, the value 0x00 was moved into the W register and the value was saved into the memory location name, Count.

The counter loop was written in order to call for display subroutine, but this instruction was used few times in the subroutine to give the program enough delay to display each of the digits. The display subroutine moves the contents of temporary location into the W register and calls the lookup table to get number in the range of 0 to 9. The 7 segment display was moved into the port D and then by setting the bit 1 of port C this bit of the port was activated. A delay of 10msec was called in this stage for delay and then bit 1 was deactivated to the LSB of 7 segments. The content of the counter was swapped and the value then was stored into WREG. The lookup table was again called to get the number and the 7-segment display on the LCD screen. The bit 0 of port C was activated to display the number on the LSB digit and this process with the delay of 10msec was repeated twice and returned.

 Then; the counter value was moved into the WREG and 1 was adding to it to count up and the DAW instruction was used to keep the value as BCD (binary code number). The counter then was moved into the WREG and program was branched back into the title of the subroutine.(counter_loop).

The look up table of 7 segments was written to firstly discard the upper 4 bits of the contents of the W register and then incrementing its content. The addwf PCL,F was then used to add WREG content to the program counter in order to jump relative to the value which was stored in the W register.  The numbers then was found according to the table 1 and was load and returned by using the instruction retlw. The program then was branched back for an endless loop before the end instruction.

Result: After the program was built and run, digits from the 0 to 9 were displayed on the right hand display. This cycle was continued until the program was reset.

Double digit

The previous program was modified with having counter_loop and initialization loop untouched. The display loop however was modified by activating bit 2 of the PortC by selecting this bit within the PortC. That was done in order to display the number on the least significant digit. That bit then was cleared to deactivate the least significant bit 7-segment of the PortC. Between setting and clearing of bit 2 of PortC delay of 10m second was called to display the digits on the LCD screen with some delay in between.

The look up table for 7 segment display was also modified with adding letters from A up to F for extending the counter to double digit form.

Result:

After the program was built and run, the counting began on the LCD from digit 0 up to 99. Similarly to the previous step, the right hand display count from 0 up to 9 and the left hand display (most significant bit) was increased by 1 when the first cycle of (0-9) was displayed. After the program reaches to digit 99, the program repeats the loop to begin the counting again.

The PortC, 1 was set to activate the number on the least significant bit digit while the PortC ,2 was set to activate and display the  number on the most significant bit digit. The program can be stop by resetting it since the stop push button was not activated.

The counter was incremented for 100 ms by call display 5 times. The result of this step was appeared on the LED in the hex and the BCD format 0 to 99.

Up-down counter

In this step of the practical, the aim is to use the green push button on the main board (PB1) to start the counter from zero up to 9 when the start button is pressed. In order to accomplish this, the previous program was modified by adding an extra subroutine for the push button.

In the button_for _start subroutine, after the display subroutine was called the btfsc  PORTB,4 instruction was used in order to activate the start button and the program then will be branched to go back to the title of this subroutine until the required push button was pressed. In order to activate the stop button a bit 3 of the Port was used (btfsc PORTB,3).

Result:

After the program was build and run, similar result to the previous step was obtained after the green push button (PB1) was pressed and the counting cycle began.

Conclusion:

In the conclusion, it was learned from this practical how to display a digit in one or two digit on the LED by configuring the ports B and C and sent them to the Port D to be displayed. The counter also was displayed on the LED in both hex and BCD format and the start and stop button were also implemented.

Electrical & Electronics, Engineering

  • Category:- Electrical & Electronics
  • Reference No.:- M9526182

Have any Question?


Related Questions in Electrical & Electronics

Questions -problem 1 - a series rlc network has r 2 komega

Questions - Problem 1 - A series RLC network has R = 2 kΩ, L = 40 mH and C = 1μF. Calculate the impedance at resonance and at one-fourth, one-half, twice, and four times the resonant frequency. Problem 2 - Design a serie ...

Questions -problem 1 - given the sinuosidal voltage vt 50

Questions - Problem 1 - Given the sinuosidal voltage v(t) = 50 cos(30t+10 o ) V, find: (a) the amplitude V m (b) the period T, (c) the frequency f and (d) v(t) at t = 10 ms. Problem 2 - A current source in a linear circu ...

Questions -q1 a single-phase transformer rated 21 kv130 v

Questions - Q1. A single-phase transformer rated 2.1 kV/130 V, 7.8 kVA has the following winding parameters: r1= 0.7Ω, x1 = 0.9Ω, r2 = 0.04Ω and x2 = 0.05Ω. Determine: a. The combined winding resistance ________ Ω and le ...

Research report1 read 3 to 4 journal articles about digital

Research report 1. Read 3 to 4 journal articles about digital control or industrial control, eg. one particular application, implementation aspect such as selection of sampling time, hardware etc. No text book example is ...

Question 1for the ce amplifier in figure 1 given the

Question 1 For the CE amplifier in Figure (1), given the following component parameters: Parameter Value β DC , β AC 150 V BE 0 . 7 V V CC 12 V R C 820 ? R E 1 100 ? R E 2 220 ? R 1 20 k? R 2 5 . 2 k? R L 100 k? C 1 , C ...

Nanotechnology engineering - resonance circuits questions

Nanotechnology Engineering - Resonance Circuits Questions - Q1) A series RLC network has R = 2KΩ, L = 40mH and C = 1μF. Calculate the impedance at resonance and at one-fourth, one-half, twice, and four times the resonant ...

1 a name the three major groups of contamination and

1. (a) Name the three major groups of contamination and briefly describe their physical characteristics. (b) Where do the above contamination types come from? Give one example of each. 2. Name two processes metrics which ...

Problems -problem 1 - find v0 in the op amp circuit of fig

Problems - Problem 1 - Find v 0 in the op amp circuit of Fig. 1. Problem 2 - Compute i 0 (t) in the op amp circuit in Fig. 2 if v s = 4 cos(10 4 t). Problem 3 - If the input impedance is defined as Z in = v s /I s , find ...

Problem 1 a two-phase servomotor has rated voltage applied

Problem 1: A two-phase servomotor has rated voltage applied to its excitation winding. The torque speed characteristic of the motor with Vc = 220 V, 60 Hz applied to its control phase winding is shown in Fig.1. The momen ...

Summative assessmentin 2017 sej101 assessment will consist

Summative Assessment In 2017 SEJ101 assessment will consist of nine tasks that will develop a portfolio of your assessed work. Throughout the trimester you will have the opportunity for feedback on all nine tasks before ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As