Tengo este problema. Estoy aprendiendo a manejar C!! Uso el MPLAB para compilar. Pero me manda este error
Clean: Deleting intermediary and output files.
Clean: Deleted file "DADO ELECTRONICO.ESYM".
Clean Warning: File "C:\Documents and Settings\FARID\Escritorio\ELECTRONICA\PIC CSS\DADO ELECTRONIC
" doesn't exist.
Clean: Deleted file "DADO ELECTRONICO.HEX".
Clean: Deleted file "DADO ELECTRONICO.LST".
Clean: Deleted file "DADO ELECTRONICO.PJT".
Clean: Deleted file "DADO ELECTRONICO.ERR".
Clean: Deleted file "DADO ELECTRONICO.COF".
Clean: Done.
Executing: "C:\Archivos de programa\PICC\Ccsc.exe" +FM "DADO ELECTRONICO.C" +DF +LN +T +A +M +Z +Y=9 +EA
*** Error 18 "DADO ELECTRONICO.C" Line 3(10,57): File can not be opened
Not in local "C:\Archivos de programa\PICC\Drivers\stdlib.C"
*** Error 12 "DADO ELECTRONICO.C" Line 57(4,9): Undefined identifier srand
*** Error 12 "DADO ELECTRONICO.C" Line 62(20,24): Undefined identifier rand
3 Errors, 0 Warnings.
Halting build on first failure as requested.
BUILD FAILED: Sat Aug 09 23:36:31 2003
EL PROGRAMA ES:
No entiendo como funciona y por qué ponen SRAND(10)
Clean: Deleting intermediary and output files.
Clean: Deleted file "DADO ELECTRONICO.ESYM".
Clean Warning: File "C:\Documents and Settings\FARID\Escritorio\ELECTRONICA\PIC CSS\DADO ELECTRONIC
Clean: Deleted file "DADO ELECTRONICO.HEX".
Clean: Deleted file "DADO ELECTRONICO.LST".
Clean: Deleted file "DADO ELECTRONICO.PJT".
Clean: Deleted file "DADO ELECTRONICO.ERR".
Clean: Deleted file "DADO ELECTRONICO.COF".
Clean: Done.
Executing: "C:\Archivos de programa\PICC\Ccsc.exe" +FM "DADO ELECTRONICO.C" +DF +LN +T +A +M +Z +Y=9 +EA
*** Error 18 "DADO ELECTRONICO.C" Line 3(10,57): File can not be opened
Not in local "C:\Archivos de programa\PICC\Drivers\stdlib.C"
*** Error 12 "DADO ELECTRONICO.C" Line 57(4,9): Undefined identifier srand
*** Error 12 "DADO ELECTRONICO.C" Line 62(20,24): Undefined identifier rand
3 Errors, 0 Warnings.
Halting build on first failure as requested.
BUILD FAILED: Sat Aug 09 23:36:31 2003
EL PROGRAMA ES:
Código:
#include "C:\Archivos de programa\PICC\Devices\16F877A.h"
#include "C:\Archivos de programa\PICC\Drivers\stdlib.C"
#FUSES NOWDT, NOLVP, PUT, XT//, INTRC
#USE delay (clock=4000000)
#use fixed_io(b_outputs=PIN_B0,PIN_B1,PIN_B2,PIN_B3)
#use standard_io(A)
////////////////////////////////////////////////////////////////////////////////////
// VsZeNeR"05
// 25/Agosto/05
//
// Programa: Dado digital
// Version: 0.0
//
// Dispositivo: PIC 16F648A Compilador: CCS vs3.227
// Entorno IDE: MPLAB IDE v7.20 Simulador: Proteus 6.7sp3
//
// Notas: Dado digital, que al presionar el boton conectado al pin A0 del porta
// genera un numero pseudo-aleatorio mediante la funcion rand() que se
// encuentra en la libreria STDLIB.H. El numero pseudo-aleatorio es elegido
// mediante la funcion rand() y segun los "rebotes" producidos por el boton.Tener
// en cuenta que hay que poner la directiva NOLVP para que el pin B4 sea de
// salida. Cuando agregamos un boton a nuestro circuito hay que tener en cuenta
// que este dispositivo genera "rebotes" que hay que ser eliminados para
// una correcta visualizacion en el display del digito seleccionado. Esta vez
// la eliminacion de "los rebotes" se ha realizado mediante software.
//
// Conexiones: A0 -> boton
// B0 -> a
// B1 -> b
// B2 -> c
// B3 -> d
// BCD:
// d c b a NUM
// 0 0 0 0 0
// 0 0 0 1 1
// 0 0 1 0 2
// 0 0 1 1 3
// 0 1 0 0 4
// 0 1 0 1 5
// 0 1 1 0 6
// 0 1 1 1 7
// 1 0 0 0 8
// 1 0 0 1 9
//////////////////////////////////////////////////////////////////////////////////
///PROGRAMA
void main(void)
{
char num=0; //variable almacena numero aleatorio
set_tris_a(0xFF); //porta como entrada
disable_interrupts(GLOBAL); //todas las interrupciones desactivadas
srand(10); //maximo hasta 9
for( ; ; ){ //bucle...
if(!input(PIN_A0)) //¿se ha pulsado el boton?
{
do{ //elimina...
num=rand(); //genera numero pseudo-aleatorio
}while(!input(PIN_A0)); //...rebotes
}
output_b(num); //muestra por portb digito 7 segmentos
} //...infinito
}
No entiendo como funciona y por qué ponen SRAND(10)
Última edición por un moderador: