The Godfather talking
This is god damn my place! Capisci?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 29, 2024, 02:05:59 14:05


Login with username, password and session length


Pages: [1]
Print
Author Topic: fuel control  (Read 4601 times)
0 Members and 1 Guest are viewing this topic.
walok
Newbie
*
Offline Offline

Posts: 13

Thank You
-Given: 0
-Receive: 1


« on: December 12, 2007, 04:25:40 04:25 »

Hi i making a fuel control system and i have a problem with the system, anybody knows how create interruptions by software???
Logged
goaman1
Guest
« Reply #1 on: December 12, 2007, 02:09:07 14:09 »

www.megasquirt.info see this but
what cpu are you using  Roll Eyes
Logged
walok
Newbie
*
Offline Offline

Posts: 13

Thank You
-Given: 0
-Receive: 1


« Reply #2 on: December 14, 2007, 09:22:07 21:22 »

i'm using a pic16f877a
Logged
future
Newbie
*
Offline Offline

Posts: 16

Thank You
-Given: 10
-Receive: 7


« Reply #3 on: December 15, 2007, 01:08:33 01:08 »

What you are looking for can be done with the output comparators.

you could also use a busy loop like

LATBbits.LATB0 = 1;
delay for some time...;
LATBbits.LATB0 = 0;
Logged
walok
Newbie
*
Offline Offline

Posts: 13

Thank You
-Given: 0
-Receive: 1


« Reply #4 on: December 15, 2007, 04:00:17 16:00 »

thanks for help...
how i can do for show the fianl design and the software made it??


Posted on: December 15, 2007, 04:59:04 16:59 - Automerged

This is the software:

//Cabeceras para diferentes dispositivos y opciones

#include <16f877a.h>            //pic a utilizar
#device ADC=8
#fuses XT,NOWDT,NOPROTECT,PUT,nobrownout,nolvp      //ordenes para el programador
#use delay (clock=4000000)         //Fosc=4Mhz
#include<keypad4x4.c>               //libreria manejo keypad
#include<lcd2.c>               //libreria manejo lcd 8bits   
#use fast_io(B)
#use fast_io(C)

#use i2c(MASTER, SDA=PIN_c4, SCL=PIN_c3, slow)


//funciones

void hora(void);
void tanques(void);
void imprimir(void);
void ajustes(void);
void toma_adc(void);

//variables globales
   char c;         //variable donde se almacena tecla pulsada
   char y=1;               //indice columnas
   signed char x=1;
   int w;
   int tank0=0x00; // variable ke guarda dato de adc canal 0
   int tank1=0x00; // variable ke guarda dato de adc canal 1
   float var01;
   float var02;
   int16 retardo; //Cada cuando actualiza lectura en LCD

//Dato en registro ds, a mandar o leer
   int seconds,minutes,hours,day,date,month,year,control;

//Registros DS1307
#define ds_seconds 0x00
#define ds_minutes 0x01
#define ds_hours 0x02
#define ds_day 0x03
#define ds_date 0x04
#define ds_month 0x05
#define ds_year 0x06
#define ds_control 0x07

///PROGRAMA
void main(void)
{
retardo=250; //ms a tardar entre lectura y lectura
//Justo cuando prende circuito, la fecha que establece es la siguiente
seconds= 0x00;
minutes= 0x20;
hours = 0x12; //modo 24 hrs
day = 0x2; //1 es domingo
date = 0x19;
month = 0x11;
year = 0x07;
control= 0x00; //OUT=0 SQWE=0 RS0-1=0 no hay onda cuadrada
//Establece fecha y hora
i2c_start(); //Inicia I2C
i2c_write(0xd0); //Direcciona DS1307 write
i2c_write(ds_seconds); //Indica que empiece en registro ds_seconds
//Aquí establece fecha y hora respecto a la puesta arriba
i2c_write(seconds);
i2c_write(minutes);
i2c_write(hours);
i2c_write(day);
i2c_write(date);
i2c_write(month);
i2c_write(year);
i2c_write(control);
i2c_stop(); //Ya puso la hora y fecha
//El RTC ya está marcando el tiempo y fecha


   lcd_init();      //inicializa lcd
   w = 41;
   while(w != 0){      //bucle...
      lcd_gotoxy(x,y);      //cursor para escribir mensaje
      lcd_putc("FUEL CONTROL");   //muestra por pantalla el mensaje
      delay_ms(150);         
      x++;               //incremento indice de filas
      if(x>16){            //¿ya se ha mostrado mensaje entero por 1ºfila?
         x=-8;            //SI -> indice fila x=-8
         y++;            //incremento indice columnas
         if(y>2)            //¿ya se ha mostrado mensaje por 2º columna?
            y=1;         //SI -> restauro indice columna
         }
        lcd_putc("\f");       //borra pantalla
      w = w-1;
     }
   
   for(;Wink{   //bucle...
      lcd_putc("[A]HORATANQUE\n[C]IMPR.[D]SETUP");   //presentacion
       do{               //espera hasta...
         c=kbd_getc();   
         }while(c==0);   //...pulsar una tecla
     
      if(c=='A')         //Mostrar hora actual
         hora();
      if(c=='B')         //Mostrar contenido de los tanques
         tanques();
      if(c=='C')         //Imprimir reporte de mediciones
       imprimir();
      if(c=='D')         //ajustar parametros del sistema
       ajustes();   
          }      //...infinito
}

void hora(void){
       for(;Wink{   //bucle...
   lcd_putc("\f");
       do{               //espera hasta...

delay_ms(retardo); //Usuario lee
//Obtiene datos de DS1307
i2c_start(); //Inicia I2C
i2c_write(0xd0); //Direcciona DS1307 write
i2c_write(ds_seconds); //Indica que ponga registro en ds_seconds
i2c_stop();

i2c_start();
i2c_write(0xd1); //Lee DS1307
seconds = i2c_read();
minutes = i2c_read();
hours = i2c_read();
day = i2c_read();
date = i2c_read();
month = i2c_read();
year = i2c_read(0); //no ack
i2c_stop();   
//Representa datos en la LCD
printf(lcd_putc,"\f%2x-%2x-20%2x\n",date,month,year); //dd-mm-year
printf(lcd_putc,"%2x:%2x:%2x",hours,minutes,seconds); //23:59:59
delay_ms(100);
         c=kbd_getc();   
         }while(c==0);   //...pulsar una tecla
         
      if(c=='*' || c=='#'){      //si se pulsa * o # se sale de la funcion
        break;               //salir de funcion nueva_clave
        lcd_putc("\f");
         }
         } //...inifinito
         lcd_putc("\f");
      }
 
void tanques(void){
   for(;Wink{   //bucle...
   lcd_putc("\f");
   do{            //espera hasta...
   setup_adc(ADC_CLOCK_INTERNAL); //configura el converso 
   setup_adc_ports( RA0_RA1_RA3_ANALOG ); //entrada 0,1 y 3 como analogicas
   toma_adc();
   lcd_gotoxy(1,1);
   lcd_putc("Tanque0=\nTanque1=");   //presentacion
   lcd_gotoxy(10,1);
   printf(lcd_putc,"%1.2f",var01);
   //lcd_putc(tank0);   //presentacion
   lcd_gotoxy(10,2);
   //lcd_putc(tank1);   //presentacion
   printf(lcd_putc,"%1.2f",var02);
        c=kbd_getc();   
         }while(c==0);   //...pulsar una tecla
      if(c=='*' || c=='#'){      //si se pulsa * o # se sale de la funcion
        break;               //salir de funcion nueva_clave
        lcd_putc("\f");
         }
          } //...inifinito
         lcd_putc("\f");
      }
 
void toma_adc(void){ 
// Lectura de los canales 0 y 1 
   set_adc_channel(0); 
   delay_ms(1); 
   tank0=read_adc();
   var01=(float)tank0/12;
   delay_ms(10); //para que se estabilice 
 
   set_adc_channel(1);
   delay_ms(1); 
   tank1=read_adc();
   var02=(float)tank1/12;
   delay_ms(10); //para que se estabilice
   } 
 
void imprimir(void){
    for(;Wink{   //bucle...
   lcd_putc("\f");
   lcd_putc("Imprimir");   //presentacion
   
      do{               //espera hasta...
         c=kbd_getc();   
         }while(c==0);   //...pulsar una tecla
         
      if(c=='*' || c=='#'){      //si se pulsa * o # se sale de la funcion
        break;               //salir de funcion nueva_clave
        lcd_putc("\f");
         }
          } //...inifinito
         lcd_putc("\f");
      }

void ajustes(void){
   for(;Wink{   //bucle...
   lcd_putc("\f");
   lcd_putc("[1]Fecha [2]Tanq\n[3]B.mem [4]Pass");   //presentacion
   
     do{               //espera hasta...
         c=kbd_getc();   
         }while(c==0);   //...pulsar una tecla
         
      if(c=='*' || c=='#'){      //si se pulsa * o # se sale de la funcion
        break;               //salir de funcion nueva_clave
        lcd_putc("\f");
         }
          } //...inifinito
         lcd_putc("\f");
      }
Logged
morfondi
Guest
« Reply #5 on: April 16, 2008, 09:12:02 21:12 »

Hi!

What is the code good for?

Thanks.

Posted on: April 16, 2008, 10:09:10 22:09 - Automerged

Tank fuel control...

Is he allowed to weigh consumption up from the fuel tank?
Logged
vacsaa
Newbie
*
Offline Offline

Posts: 8

Thank You
-Given: 45
-Receive: 1


« Reply #6 on: April 17, 2008, 09:17:30 21:17 »

Good evening!

Yes, i am allowed the fuel tank. I 'am using PIC18F4550 and 4x20 LCD.
Source code, schematic under construction.
Logged
kami_kami
Inactive

Offline Offline

Posts: 5

Thank You
-Given: 1
-Receive: 0


« Reply #7 on: April 18, 2008, 06:20:18 06:20 »

use flow sensore?
Logged
vacsaa
Newbie
*
Offline Offline

Posts: 8

Thank You
-Given: 45
-Receive: 1


« Reply #8 on: April 20, 2008, 03:41:00 15:41 »

No, I am not use flow meter, i am use injector cable.
Logged
hhh4h
Guest
« Reply #9 on: April 20, 2008, 04:43:23 16:43 »

Are you using opto-isolators for noise immunty? Electrical niose is a big prolem on the circuit side of these designs
Logged
goaman1
Guest
« Reply #10 on: April 26, 2008, 02:27:01 14:27 »

Im working on similar project and my engine now is runnig almost fine
If you want I'll post a part which you needed
Im using 18f2525, LCD, MAP,TPS and CLT sensors.
Timing signal for injector is taken from hall sensors mounted in distributor couse my engine is little old Smiley

My designe is like MS tobe able to use MS terminal for tuning.
Code and schematic is not very well documented, but I'll take care about it if you intrested.

At all I can't understand what is the problem ?

Thanks.
« Last Edit: April 26, 2008, 02:47:56 14:47 by goaman1 » Logged
ipek
Junior Member
**
Offline Offline

Posts: 95

Thank You
-Given: 59
-Receive: 79


« Reply #11 on: April 27, 2008, 12:05:03 00:05 »

walok  hi
c code extra special library need keypad4x4.c lcd2.c ea..
plaese sharing file for example fuel.c fuel.hex and library rar or zip ped
best reagards...
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC