dani333
Junior Member level 1
I'm looking for a compiler for the program under this program to eat and give me the hex code :
#include <18f242.h>
#device ADC=8
#use delay(clock = 4000000)
#define param 19.6079
#define use_portb_lcd TRUE
#include <lcd.c>
int8 adc_data;
float adc_voltage;
void main()
{
set_tris_c(0x00);
output_c(0x00);
lcd_init();
lcd_gotoxy(1,1);
printf(lcd_putc , "PIC18 Voltage Probe");
setup_adc(ADC_CLocK_DIV_32);
setup_adc_ports(ALL_ANALOG);
set_adc_channel(0);
delay_ms(20);
while(1)
{
adc_data=read_adc();
if(adc_data >= 230)
{
output_high(pin_c0);
}
if(adc_data <= 25)
{
output_high(pin_c2);
}
if(adc_data >= 25 & adc_data <=230)
{
output_high(pin_c1);
}
adc_voltage = adc_data * param /1000;
lcd_gotoxy(1,2);
printf(lcd_putc , "Voltage = %f , Digital = %3u" , adc_voltage , adc_data);
delay_us(50);
output_c(0x00);
}
}
--------------------------------------------
What these programs compiled with the hex code to take ...!!
#include <18f242.h>
#device ADC=8
#use delay(clock = 4000000)
#define param 19.6079
#define use_portb_lcd TRUE
#include <lcd.c>
int8 adc_data;
float adc_voltage;
void main()
{
set_tris_c(0x00);
output_c(0x00);
lcd_init();
lcd_gotoxy(1,1);
printf(lcd_putc , "PIC18 Voltage Probe");
setup_adc(ADC_CLocK_DIV_32);
setup_adc_ports(ALL_ANALOG);
set_adc_channel(0);
delay_ms(20);
while(1)
{
adc_data=read_adc();
if(adc_data >= 230)
{
output_high(pin_c0);
}
if(adc_data <= 25)
{
output_high(pin_c2);
}
if(adc_data >= 25 & adc_data <=230)
{
output_high(pin_c1);
}
adc_voltage = adc_data * param /1000;
lcd_gotoxy(1,2);
printf(lcd_putc , "Voltage = %f , Digital = %3u" , adc_voltage , adc_data);
delay_us(50);
output_c(0x00);
}
}
--------------------------------------------
What these programs compiled with the hex code to take ...!!