Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
yeah it's called Google do a search yourself and you will find. Were not here to do your work for you.
what have you done yourself ?
I did not state we need to closse EDA, All that I stated was we are not here do to do the work for him. He has given us so little information to go on and work he has already worked on where is he stuck, he has given us nothing to work on.so we better close this EDABOARD FORUM..
skyleft:
can you specific with your problem..i mean a problem with code or anything else?
so we better close this EDABOARD FORUM..
Who are you to decide what should be done?
void main()
{
unsigned long Vin, mV;
unsigned char op[12];
unsigned char i,j,lcd[5];
TRISC = 0; // PORTC are outputs (LCD)
TRISA = 0xFF; // PORTA is input
//
// Configure LCD
//
Lcd_Init(&PORTC); // LCD is connected to PORTC
Lcd_Cmd(LCD_CLEAR);
Lcd_Out(1,1,"VOLTMETER");
Delay_ms(2000);
//
// Configure A/D converter. AN0 is used in this project
//
ADCON1 = 0x80; // Use AN0 and Vref=+5V
//
// Program loop
//
for(; // Endless loop
{
Lcd_Cmd(LCD_CLEAR);
Vin = Adc_Read(0); // Read from channel 0 (AN0)
Lcd_Out(1,1,"mV = "); // Display "mV = "
mV = (Vin * 5000) >> 10; // mv = Vin x 5000 / 1024
LongToStr(mV,op); // Convert to string in "op"
//
// Remove leading blanks
//
j=0;
for(i=0;i<=11;i++)
{
if(op != ' ') // If a blank
{
lcd[j]=op;
j++;
}
}
//
// Display result on LCD
//
Lcd_Out(1,6,lcd); // Output to LCD
Delay_ms(1000); // Wait 1 second
}
}
;PROGRAM WRITTEN BY SYED TAHMID MAHBUB
;DATED - 29 DECEMBER 2010
;PROGRAMMING LANGUAGE - ASSEMBLER
;COMPILER - MPASM
;IDE - MPLAB v8.30
LIST P=18F4550
#INCLUDE "P18F4550.INC"
__CONFIG _CONFIG1H, _FOSC_XT_XT_1H
__CONFIG _CONFIG2L, _BOR_OFF_2L & _PWRT_OFF_2L
__CONFIG _CONFIG2H, _WDT_OFF_2H
__CONFIG _CONFIG4L, _DEBUG_OFF_4L & _LVP_OFF_4L & _XINST_OFF_4L
__CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L
__CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
__CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L
__CONFIG _CONFIG6H, _WRTB_OFF_6H & _WRTC_OFF_6H & _WRTD_OFF_6H
__CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L
__CONFIG _CONFIG7H, _EBTRB_OFF_7H
ORG 0 ;RESET VECTOR
GOTO MAIN ;START EXECUTING FROM MAIN
CBLOCK ;GENERAL PURPOSE REGISTERS
D1
ENDC ;END DECLARATION BLOCK
DELAY ;ACQUISITION DELAY
MOVLW 30
MOVWF D1
DECFSZ D1
BRA $-1
RETURN ;RETURN FROM SUBROUTINE
MAIN
BSF TRISA,1 ;RA0 INPUT
CLRF TRISB ;PORTB OUTPUT
CLRF PORTB ;CLEAR INITIAL PORTB STATE
MOVLW 0x3E ;8-BIT, 20TAD, FOSC/64
MOVWF ADCON2 ;LOADED INTO ADCON2
MOVLW 0x0E ;VDD AND VSS REFERENCE, CH0 ANALOG, REST DIGITAL
MOVWF ADCON1 ;LOADED INTO ADCON1
CLRF ADCON0 ;CH0, ADC OFF
BSF ADCON0,ADON ;ADON = 1, ADC RUNNING
LOOP
RCALL DELAY ;CALL ACQUISITION DELAY
BSF ADCON0,GO_DONE ;START CONVERSION
BTFSC ADCON0,GO_DONE ;CHECK IF GO_DONE = 0, IE, CONVERSION COMPLETE
BRA $-1 ;IF NOT CHECK AGAIN
MOVFF ADRESH, LATB ;WHEN COMPLETE, LOAD CONTENTS OF LATB (PORTB) WITH ADC RESULT
BRA LOOP ;REPEAT CONVERSION
END