amigos del foro cordial saludo
bueno les comento he diseñado un codigo que es un ohmetro digital en mplab xide con c16 pero al compilar me genera muchos errores.
este es el codigo
/*
* File: Ohmetro.c
* Author: JOSE
*
* Created on 27 de febrero de 2020, 05:44 PM
*/
// DSPIC30F2010 Configuration Bit Settings
// 'C' source line config statements
// FOSC
#pragma config FPR = HS // Primary Oscillator Mode (HS)
#pragma config FOS = FRC // Oscillator Source (Internal Fast RC)
#pragma config FCKSMEN = CSW_FSCM_OFF // Clock Switching and Monitor (Sw Disabled, Mon Disabled)
// FWDT
#pragma config FWPSB = WDTPSB_16 // WDT Prescaler B (1:16)
#pragma config FWPSA = WDTPSA_512 // WDT Prescaler A (1:512)
#pragma config WDT = WDT_OFF // Watchdog Timer (Disabled)
// FBORPOR
#pragma config FPWRT = PWRT_64 // POR Timer Value (64ms)
#pragma config BODENV = NONE // Brown Out Voltage (Reserved)
#pragma config BOREN = PBOR_ON // PBOR Enable (Enabled)
#pragma config LPOL = PWMxL_ACT_HI // Low-side PWM Output Polarity (Active High)
#pragma config HPOL = PWMxH_ACT_HI // High-side PWM Output Polarity (Active High)
#pragma config PWMPIN = RST_IOPIN // PWM Output Pin Reset (Control with PORT/TRIS regs)
#pragma config MCLRE = MCLR_EN // Master Clear Enable (Enabled)
// FGS
#pragma config GWRP = GWRP_OFF // General Code Segment Write Protect (Disabled)
#pragma config GCP = CODE_PROT_ON // General Segment Code Protection (Enabled)
// FICD
#pragma config ICS = PGD // Comm Channel Select (Use PGC/EMUC and PGD/EMUD)
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
#include <xc.h>
int main(void)
{
Initilize_LCD();
ConfigModuleADC();
ChangeChannelADC(0);
while(1)
{
DisplayResistance();
__delay__ ms(100);
}
return 0;
}
}
void DisplayResistance(void)
{
const char Voltage [] = "Ohmetro Digital";
unsigned char Unit = 0;
const float R3 = 1000, Vcc = 5.0;
unsigned int ADC_Value = 0;
float VoltageOutput = 0;
unsigned long ResistanceMeasured = 0;
ClearScreen_LCD();
WriteString_LCD(Voltage);
MoveCursorToPosition(Secondline);
ADC_Value = SamplingAndConversionADC();
VoltageOuput = ((float) (ADC_Value)) * 0.004828;
ResistanceMeasured = (unsigned long)((VoltageOutput * R3) / (Vcc-VoltageOutput));
unit = WriteLongAsFloatUptoFiveFigures(ResistanceMeasured);
if (Unit ==2)
WriteString_LCD("MOhm");
else if (Unit ==1)
WriteString_LCD("KOhm");
else if (!Unit)
WriteString_LCD("Ohm");
else
WriteString_LCD("Fuera del Rango ");
}
espero y me puedan ayudar amigos

gracias
jose