[PROYECTO] Fabricar un sistema de control
Solo para comentarles que por mi parte ya tengo algo de avance en mi sistema de control on/off por medio de PIC (18F4550), subí los esquematicos y firmware por si a alguien mas le interesa y me puede ayudar a probar el sistema, estan en el post de mi máquina http://reballing.es/viewtopic.php?f=31&t=589.
- Thulsa_Doom
- Reboleador Extremo
- Mensajes: 557
- Registrado: Lun Ago 24, 2009 3:24 pm
Gracias por el aporte, una pregunta estúpida, la librería del max6675, ¿para que programa es?.
para ayudar subo un enlace a megaupload en español del pic 18F4550.
http://www.megaupload.com/?d=6ZZR8VE0
Voy a exponer el driver para el maxim6675, creo que es para el compilador CCS C.
para ayudar subo un enlace a megaupload en español del pic 18F4550.
http://www.megaupload.com/?d=6ZZR8VE0
Voy a exponer el driver para el maxim6675, creo que es para el compilador CCS C.
Código: Seleccionar todo
/**************************************************************************************
* max6675.c - communicates with a MAX6675 thermcouple interface chip *
* Copyright Jimbob's Ma 2006 *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation version 2 *
* of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
**************************************************************************************/
/*
This is a diver for the MAX6675 K-type thermocouple interface chip. It implements an SPI
bus without the need for dedicated hardware (aka a bit-banged interface). The result from
toFloat_TC() is the temperature in degrees celcius of the thermocouple tip. The rest should
be self-evident. Have a look at the end of the file for example usage.
*/
#ifndef TC_CLK
#define TC_CLK PIN_B1 //edit these pins as necessary
#endif
#ifndef TC_CS
#define TC_CS PIN_B2
#endif
#ifndef TC_DATA
#define TC_DATA PIN_B3
#endif
int1 thermocouple_error; //a handy dandy global error flag to tell you if a thermocouple is connected or not
void init_TC(void)
{
output_low(TC_CLK);
output_low(TC_DATA);
output_high(TC_CS); //if we idle high, the chip keeps doing conversions. Change this if you like
}
int16 read_TC(void) //It takes 200ms (ish) for the MAX6675 to perform a conversion
{
int8 i;
int16 data;
output_low(TC_CS); //stop any conversion processes
delay_us(1); //and give it some time to power up (not very much, admittedly)
for (i=0;i<16;i++){
shift_left(&data,2,input(TC_DATA)); //reads in 2 bytes to data from the pin TC_DATA
output_high(TC_CLK);
output_low(TC_CLK);
}
thermocouple_error=bit_test(data,2); //this is the thermocouple status bit
output_high(TC_CS);
return(data);
}
int16 sortout(int16 raw)
{
return(0x0FFF & (raw>>3)); //returns only the bits converning temperature
}
float toFloat_TC(int16 tmp)
{
return((float)tmp/4.0); //adjusts data to floating point format, and accounts for the decimal point
}
float do_everything(void)
{
init_TC();
delay_ms(200); //200ms is a long time to be doing nothing. use a timer interrupt to avoid wasting time here
return(toFloat_TC(sortout(read_TC())));
}
/*
//example program
#define TC_CLK PIN_B2
#define TC_CS PIN_B2
#define TC_DATA PIN_B1
#include "max6675.c"
void main()
{
char msg[32];
delay_ms(50); //allow oscillator to stabilise
while(1){
delay_ms(800);
sprintf(msg,"%01.2f%cC\r\n",do_everything(),0xB0);
if(thermocouple_error)
printf("Thermocouple not connected\r\n");
else
printf("%s",msg);
}
}
*/
Si cada vez que se dice manteca, dios mata un gatito, no os preocupéis, en el callejón de al lado de mi edificio hay un contenedor de basura que por las noches está lleno
ZM5860C
Horno de reflujo casero con un control fabricado por mi en evolución
ZM5860C
Horno de reflujo casero con un control fabricado por mi en evolución
- Thulsa_Doom
- Reboleador Extremo
- Mensajes: 557
- Registrado: Lun Ago 24, 2009 3:24 pm
vale gracias, estaba buscando la librería para el proteus para armar el proyecto sin utilizar protoboard
Si cada vez que se dice manteca, dios mata un gatito, no os preocupéis, en el callejón de al lado de mi edificio hay un contenedor de basura que por las noches está lleno
ZM5860C
Horno de reflujo casero con un control fabricado por mi en evolución
ZM5860C
Horno de reflujo casero con un control fabricado por mi en evolución
- compupasion
- Reboleador Extremo
- Mensajes: 554
- Registrado: Dom Mar 28, 2010 6:00 pm
Esta es la rutina en el hilo nuevo "Sistema de control Elektor", ahi se puede descargar todo. gracias al aporte de Xose_Maria.
#include <stdio.h>
#include "..\regat89s8253.h"
#include "max6675.h"
#define MAX_SO P2_0
#define MAX_NCS P2_1
#define MAX_SCK P2_2
extern volatile signed char temp_adjust;
unsigned int MAX6675_read_temperature (void)
{
unsigned int shiftreg = 0;
unsigned char count;
MAX_SO = 1; // SO is input
MAX_SCK = 0; // clock is low, needed for first time use
MAX_NCS = 0; // Select the max6675 and stop conversion
for (count=0;count<13;count++)
{
MAX_SCK=1;
shiftreg = shiftreg << 1;
if (MAX_SO == 1) shiftreg=shiftreg +1;
MAX_SCK=0;
}
for (count=0;count<3;count++) // disregard the last 3 bytes
{
MAX_SCK=1;
MAX_SCK=0;
}
MAX_NCS = 1; // Start next conversion
shiftreg=shiftreg+(signed int)(temp_adjust*4);
return (shiftreg);
}
se obtiene el valor en temp asi:
temp=MAX6675_read_temperature();
Las otras librerias .h que aparecen tambien estan y parecen ser exportables.
Pongo esto por si sirve, a mi me gusto.
#include <stdio.h>
#include "..\regat89s8253.h"
#include "max6675.h"
#define MAX_SO P2_0
#define MAX_NCS P2_1
#define MAX_SCK P2_2
extern volatile signed char temp_adjust;
unsigned int MAX6675_read_temperature (void)
{
unsigned int shiftreg = 0;
unsigned char count;
MAX_SO = 1; // SO is input
MAX_SCK = 0; // clock is low, needed for first time use
MAX_NCS = 0; // Select the max6675 and stop conversion
for (count=0;count<13;count++)
{
MAX_SCK=1;
shiftreg = shiftreg << 1;
if (MAX_SO == 1) shiftreg=shiftreg +1;
MAX_SCK=0;
}
for (count=0;count<3;count++) // disregard the last 3 bytes
{
MAX_SCK=1;
MAX_SCK=0;
}
MAX_NCS = 1; // Start next conversion
shiftreg=shiftreg+(signed int)(temp_adjust*4);
return (shiftreg);
}
se obtiene el valor en temp asi:
temp=MAX6675_read_temperature();
Las otras librerias .h que aparecen tambien estan y parecen ser exportables.
Pongo esto por si sirve, a mi me gusto.
Estacion: Hacky 4000 -AZP
Esa rutina sería para cuando tienes un microcontrolador sin hardware SPI ya que por lo que veo también hace la señal de reloj (SCK).
Para los que usan mikroC y un micro con hardware SPI otra rutina para hacer la lectura sería asi:
un ejemplo de uso:
Para los que usan mikroC y un micro con hardware SPI otra rutina para hacer la lectura sería asi:
Código: Seleccionar todo
unsigned int Leer_Temperatura(void)
{
unsigned short byte1_spi=0, byte2_spi=0, buffer=0;
unsigned int Temperatura=0;
byte1_spi = SPI1_Read(buffer);
byte2_spi = SPI1_Read(buffer);
Temperatura = ( ( byte1_spi*256) + byte2_spi ) / 32;
return Temperatura;
}
Código: Seleccionar todo
unsigned int Termopar1 = 0, Termopar2=0; //Las variables donde guardaremos
//la temperatura
SPI1_Init(); // Función que inicia el hardware SPI ya incluida en la
//librería SPI de mikroC
void main()
{
/*Para el termopar 1*/
RB2_bit=0; //pone en estado bajo el pin CS(chip select) del maxim6675
//que vamos a leer, en este caso el del termopar1.
Termopar1 = Leer_Temperatura();
RB2_bit=1; //lo vuelve a poner en estado alto indicando que terminamos
// de leer ese chip
/* Para el termopar 2 */
RB3_bit=0;
Termopar2 = Leer_Temperatura();
RB3_bit=1;
}
- Thulsa_Doom
- Reboleador Extremo
- Mensajes: 557
- Registrado: Lun Ago 24, 2009 3:24 pm
Aquí: http://www.ucontrol.com.ar/forosmf/proy ... adura-smd/
se habla de un proyecto similar, expone cosas muy interesantes lo malo es que el hilo lleva tiempo abandonado, yo he preguntado que ha pasado pero nadie ha contestado, pero se pueden ver rutinas y explicaciones del funcionamiento del max6675
Aaaa otra cosa que me olvidaba, voy ha aportar el código fuente de un control, no se si estará entero, echen le un vistazo y dicen algo.
http://www.megaupload.com/?d=DG7EN3XM
se habla de un proyecto similar, expone cosas muy interesantes lo malo es que el hilo lleva tiempo abandonado, yo he preguntado que ha pasado pero nadie ha contestado, pero se pueden ver rutinas y explicaciones del funcionamiento del max6675
Aaaa otra cosa que me olvidaba, voy ha aportar el código fuente de un control, no se si estará entero, echen le un vistazo y dicen algo.
http://www.megaupload.com/?d=DG7EN3XM
Si cada vez que se dice manteca, dios mata un gatito, no os preocupéis, en el callejón de al lado de mi edificio hay un contenedor de basura que por las noches está lleno
ZM5860C
Horno de reflujo casero con un control fabricado por mi en evolución
ZM5860C
Horno de reflujo casero con un control fabricado por mi en evolución
- martinzulu
- Pop Corn
- Mensajes: 43
- Registrado: Dom Jun 06, 2010 12:50 am
Este circuito y control debe servirle mucho aragonrfh pues ya tiene las rampas necesarias y lo bueno es que estan probadas, es de adecuarlas a tu pic y listo ojealo.
Saludos
Saludos
No tienes los permisos requeridos para ver los archivos adjuntos a este mensaje.
hola
Aqui tiene un pcb por testear el pic 18f4550
http://sites.google.com/site/funlw65/el ... eejalduino
para empezar a programar

Aqui tiene un pcb por testear el pic 18f4550
http://sites.google.com/site/funlw65/el ... eejalduino
para empezar a programar
la bga light rafale en construcción .....
