Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Displaying ADC Value on 2 7-Segment Displays

Status
Not open for further replies.

janosandi

Full Member level 4
Joined
Jan 23, 2010
Messages
210
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
2,788
Hello Guys
i've connected an potentiometer to AN0 of PIC16F877 & read the results on 8 LEDS connected to portD & its ok
but i need to display the exact value of ADC on 2 7segment displays for Calculating Values for a Thermistor

was thinking how to get (for example) "15" on 7seg
i can send 1 to tens in my 7seg display Routine & 5 to units
But when i get 0F as value from ADC how to Seperate it to use 1 for tens & 5 for units?

i need this to make a table for a Thermistor reading

This is the routine im using to display Values on 7 segments
Code:
DispRoutine
		movlw	b'00000001'	;Activate Units Display
		movwf	portE
		movf	        units,0
		call	        table
		movwf	portB
		call	        D_10mS
		clrf	        portB
		movlw	b'00000010'	;Activate Tens Display
		movwf	portE
		movf	       tens,0
		call	        table
		movwf	portB
		call	        D_10mS
retlw	0x00
 

Where is your circuit diagram? How are you connecting 7seg with controller?

I d'not know assembly but i can explain you in simple math and c language. If you want to send 15 to 7seg. you would be break ADC_Value(15) to two part.

Code:
firstX = ADC_Value/10;
secondX = ADC_Value%10;
active_upper_digit_of_7seg();
PORTD = firstX;
active_lower_digit_of_7seg();
PORTD = secondX;
 

Where is your circuit diagram? How are you connecting 7seg with controller?

I d'not know assembly but i can explain you in simple math and c language. If you want to send 15 to 7seg. you would be break ADC_Value(15) to two part.

Code:
firstX = ADC_Value/10;
secondX = ADC_Value%10;
active_upper_digit_of_7seg();
PORTD = firstX;
active_lower_digit_of_7seg();
PORTD = secondX;

What is the meaning of ADC Value/10 & ADC Value %10?
& my circuit conected with the 7 segment the same way your code in C works


So wht i need is tht Really seperate a number into 2 parts But in assembly
 
Last edited:

What is the meaning of ADC Value/10 & ADC Value %10?

Your controller pin AN0 is ADC pin where you are reading analog potentiometer value.
for exa.

value is 15. i am ADC Value/10 dividing 15 by 10. result will be 1 because it is a integer type.
ADC Value %10 I am getting reminder of 15 with divide by 10. it will be 5.

& my circuit conected with the 7 segment the same way your code in C works

You can not send data directly to port for display wit 7seg. you would need a 7seg driver ic like 4511 or you would be need make function as your circuit.
for example.

i want to send 1 value. if i will send 1 to PORTD. it will like 00000001. if my 7seg is connected directly to my port... at this time only single LED will lightup but i need 2 LED lightup for sow 1 on 7Seg.

So wht i need is tht Really seperate a number into 2 parts But in assembly

I d'not know assembly language.
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top