willdoidao
(usa Ubuntu)
Enviado em 19/06/2012 - 19:53h
Fala pessoal estou com uma duvida em relação ao compilador sdcc, estou tentando gerar o .hex do seguinte código:
"#include <16f877.h>
#use delay (clock=4000000)
#fuses HS,NOWDT,PUT,NOLVP,XT,NOPUT,NOPROTECT,NOBROWNOUT
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,errors,stream=pc)
void verificacao()
{
char est1,est2,est3,est4,est5;
//Estado da Sala
if(!input(pin_b0))
est1 ='Q';
else
est1 ='q';
//Estado do Quarto
if(!input(pin_b1))
est2 ='Z';
else
est2 ='z';
//Estado da Cozinha
if(!input(pin_b2))
est3 ='S';
else
est3 ='s';
//Estado da Panela
if(!input(pin_b3))
est4 ='E';
else
est4 ='e';
//Estado do Abajur
if(!input(pin_b4))
est5 ='C';
else
est5 ='c';
//Imprimindo a Resposta
fprintf(pc,"%c%c%c%c%c\n\r",est1,est2,est3,est4,est5);
delay_ms(150);
}
void main (void)
{
char dir; //variaveis de controle das lampadas
int a0,a1,a2,a3,opc; //variaveis de controle dos motores e switch-case
//Inicializa��o das Variveis
a0=a1=a2=a3=opc=0;
while(true){
while(!kbhit()); //aguarda at� que seja recebido um dado na porta serial
dir=getc(); //armazena em c o caracter recebido na porta serial
//SALA
if (dir == 'q') //Liga a Sala
opc=1;
else if (dir == 'Q') // Desliga a Sala
opc=2;
//QUARTO
if (dir == 'z') //Liga o Quarto
opc=3;
else if (dir == 'Z') // Desliga o Quarto
opc=4;
//COZINHA
if (dir == 's') //Liga a Cozinha
opc=5;
else if (dir == 'S') // Desliga a Cozinha
opc=6;
//PANELA
if (dir == 'e') //Liga a Panela
opc=7;
else if (dir == 'E') // Desliga a Panela
opc=8;
//Abajur
if(dir == 'c') //Liga o Abajur
opc=9;
else if (dir == 'C') // Desliga o Abajur
opc=10;
//Tabela de verifica��o
else if (dir == 'p')
opc=12;
switch(opc)
{
case 1: //Liga SALA
output_high(pin_b0);
delay_ms(100);
verificacao();
break;
case 2: //Desliga SALA
output_low(pin_b0);
delay_ms(100);
verificacao();
break;
case 3: //Liga Quarto
output_high(pin_b1);
delay_ms(100);
verificacao();
break;
case 4: //Desliga Quarto
output_low(pin_b1);
delay_ms(100);
verificacao();
break;
case 5: //Liga Cozinha
output_high(pin_b2);
delay_ms(100);
verificacao();
break;
case 6: //Desliga Cozinha
output_low(pin_b2);
delay_ms(100);
verificacao();
break;
case 7: //Liga Panela
output_high(pin_b3);
delay_ms(100);
verificacao();
break;
case 8: //Desliga Panela
output_low(pin_b3);
delay_ms(100);
verificacao();
break;
case 9: //Liga Abajur
output_high(pin_b4);
delay_ms(100);
verificacao();
break;
case 10: //Desliga Abajur
output_low(pin_b4);
delay_ms(100);
verificacao();
break;
case 12:
delay_ms(100);
verificacao();
delay_ms(100);
break;
} //Fim do Switch-case
} // Fim do While True
}//Fim do Void"
No compilador do Windows está funcionando perfeitamente, só quando tento compilar pelo Linux retorna o seguinte erro:
will@will-laptop:~/Área de trabalho$ sdcc --debug -mpic14 -p16f877a Serial.c
Serial.c:2:20: error: 16f877.h: No such file or directory
Serial.c:3:2: error: invalid preprocessing directive #use
Serial.c:4:2: error: invalid preprocessing directive #fuses
Serial.c:5:2: error: invalid preprocessing directive #use
Serial.c:12: warning 112: function 'input' implicit declaration
Serial.c:18: warning 112: function 'input' implicit declaration
Serial.c:24: warning 112: function 'input' implicit declaration
Serial.c:30: warning 112: function 'input' implicit declaration
Serial.c:36: warning 112: function 'input' implicit declaration
Serial.c:44: warning 112: function 'fprintf' implicit declaration
Serial.c:46: warning 112: function 'delay_ms' implicit declaration
Serial.c:12: error 101: too many parameters
Serial.c:18: error 101: too many parameters
Serial.c:24: error 101: too many parameters
Serial.c:30: error 101: too many parameters
Serial.c:36: error 101: too many parameters
Serial.c:44: error 101: too many parameters
Serial.c:46: error 101: too many parameters
Serial.c:62: warning 112: function 'kbhit' implicit declaration
Serial.c:63: warning 112: function 'getc' implicit declaration
Serial.c:104: warning 112: function 'output_high' implicit declaration
Serial.c:105: warning 112: function 'delay_ms' implicit declaration
Serial.c:110: warning 112: function 'output_low' implicit declaration
Serial.c:111: warning 112: function 'delay_ms' implicit declaration
Serial.c:116: warning 112: function 'output_high' implicit declaration
Serial.c:117: warning 112: function 'delay_ms' implicit declaration
Serial.c:122: warning 112: function 'output_low' implicit declaration
Serial.c:123: warning 112: function 'delay_ms' implicit declaration
Serial.c:128: warning 112: function 'output_high' implicit declaration
Serial.c:129: warning 112: function 'delay_ms' implicit declaration
Serial.c:134: warning 112: function 'output_low' implicit declaration
Serial.c:135: warning 112: function 'delay_ms' implicit declaration
Serial.c:140: warning 112: function 'output_high' implicit declaration
Serial.c:141: warning 112: function 'delay_ms' implicit declaration
Serial.c:146: warning 112: function 'output_low' implicit declaration
Serial.c:147: warning 112: function 'delay_ms' implicit declaration
Serial.c:152: warning 112: function 'output_high' implicit declaration
Serial.c:153: warning 112: function 'delay_ms' implicit declaration
Serial.c:158: warning 112: function 'output_low' implicit declaration
Serial.c:159: warning 112: function 'delay_ms' implicit declaration
Serial.c:166: warning 112: function 'delay_ms' implicit declaration
Serial.c:168: warning 112: function 'delay_ms' implicit declaration
Serial.c:60: error 20: Undefined identifier 'true'
Serial.c:104: error 101: too many parameters
Serial.c:105: error 101: too many parameters
Serial.c:110: error 101: too many parameters
Serial.c:111: error 101: too many parameters
Serial.c:116: error 101: too many parameters
Serial.c:117: error 101: too many parameters
Serial.c:122: error 101: too many parameters
Serial.c:123: error 101: too many parameters
Serial.c:128: error 101: too many parameters
Serial.c:129: error 101: too many parameters
Serial.c:134: error 101: too many parameters
Serial.c:135: error 101: too many parameters
Serial.c:140: error 101: too many parameters
Serial.c:141: error 101: too many parameters
Serial.c:146: error 101: too many parameters
Serial.c:147: error 101: too many parameters
Serial.c:152: error 101: too many parameters
Serial.c:153: error 101: too many parameters
Serial.c:158: error 101: too many parameters
Serial.c:159: error 101: too many parameters
Serial.c:166: error 101: too many parameters
Serial.c:168: error 101: too many parameters
Já procurei alguns exemplos e nada de conseguir fazer funcionar, alguma sugestão??