How to make PIC18 Voltmeter using 7-segment LED Display

How to make PIC18 Voltmeter using 7-segment LED Display

Postby vicky99 » Sun Dec 08, 2019 10:33 am

I have coded to perform ACD with interrupt. Now i need to transfer the data to two 7-Segment LED display. I am connecting my LED pins to Port C and Port D. How do I program to transfer the recieved byte from ADRESL and ADRESH to LED display?
My code for ADC with interrupt is given below:
LIST P=PIC18F458
#include P18F458.INC
ORG 0000H
GOTO MAIN
ORG 0008H
BTFSS PIR1, ADIF
RETFIE
GOTO AD_ISR
ORG 00100H
MAIN CLRF TRISC
CLRF TRISD
BSF TRISA, 0
MOVLW 81H
MOVWF ADCON0
MOVLW 0CEH
MOVWF ADCON1
BCF PIR1, ADIF
BSF PIE1, ADIE
BSF INTCON, PEIE
BSF INTCON, GIE
OVER CALL DELAY
BSF ADCON0, GO
BRA OVER

AD_ISR
ORG 200H
MOVFF ADRESL, PORTC
MOVFF ADRESL, PORTD

BCF PIR1, ADIF
RETFIE
END

Kindly help me how to code to send the HByte and LByte data to 7- segment led display
vicky99
 
Posts: 1
Joined: Sun Dec 08, 2019 10:29 am

Re: How to make PIC18 Voltmeter using 7-segment LED Display

Postby Roche » Sun Dec 08, 2019 1:38 pm

There are a few things to think about:

What format do you want to display in? Hexadecimal, decimal or something else?

Given that the resolution of the A to D is 10 bit, do you want to display the most or least significant bits? Given that in hexadecimal the maximum would be FF or in decimal 99...

The mapping between individual bits of the port and segments of the display depends on your hardware - you need to make a table of values that correspond to displayed digits. Then you could possibly use a lookup table to generate the display...
Roche
 
Posts: 72
Joined: Fri Jul 11, 2014 12:35 pm
PIC experience: Professional 5+ years with MCHP products

Re: How to make PIC18 Voltmeter using 7-segment LED Display

Postby ric » Sun Dec 08, 2019 10:43 pm

The same question is getting a fair bit of help at https://www.microchip.com/forums/m1120364.aspx
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products


Return to ADC & Comparators

Who is online

Users browsing this forum: No registered users and 5 guests

cron