Cos'è ElectroYou | Login Iscriviti

ElectroYou - la comunità dei professionisti del mondo elettrico

accendere LED

Raccolta di codici sorgenti

Moderatore: Foto UtentePaolino

0
voti

[1] accendere LED

Messaggioda Foto Utentesystem90 » 5 ott 2009, 16:30

Salvea tutti
ho scritto questo programma con MPLAB e c18 per accendere e spegnere i led,ma quando clico su build all mi da errore.Secondo voi che cosa ho sbagliato nel codice?


ciao ciao

Codice: Seleziona tutto
//_______________________________scelta del PIC____________________________
#include<p18F8722.h>
//_______________________________inizializzazione PIC_______________________
#pragma config OSC=HS
#pragma config WDT=OFF
#pragma config LVP=OFF
//________________________________librerie__________________________________
#include<delays.h>
//_________________________________prototipi delle funzioni_________________
void beep(void);
void super_beep(int);
void initHW(void);
//_________________________________variabbili globali_______________________

//__________________________________main____________________________________
void main (void){
   initHW();
   super_beep(5);
   while(1);
}
//_____________________________________funzioni______________________________
void initHW(void){
   TRISDbits.TRISD0=0;
}

void beep(void){
   LATDbits.LATD0=1;
   Delay10KTCYx(250);
   LATDbits.LATD0=0;
   Delay10KTCYx(250);
}

void super_beep(int n){
   int c;
   for(c=1; c<=n; c++){
   beep();
   }
}
Avatar utente
Foto Utentesystem90
0 2
 
Messaggi: 23
Iscritto il: 21 set 2009, 10:39

0
voti

[2] Re: accendere LED

Messaggioda Foto UtenteDonJ » 5 ott 2009, 16:42

non è che mi dici anche che errore ti da e dove?
"Computers, operating systems, networks are a hot mess. They're barely manageable, even if you know a decent amount about what you're doing. Nine out of ten software engineers agree: it's a miracle anything works at all."
@fasterthanlime
Avatar utente
Foto UtenteDonJ
4.611 6 10 13
Master EY
Master EY
 
Messaggi: 2562
Iscritto il: 19 lug 2009, 22:13
Località: Croccamauria

0
voti

[3] Re: accendere LED

Messaggioda Foto Utentec1b8 » 5 ott 2009, 16:50

Ho spostato la discussione in Software di PICmicro - Peripheral Interface Controller.
Fabio
Avatar utente
Foto Utentec1b8
3.595 3 8 13
G.Master EY
G.Master EY
 
Messaggi: 1770
Iscritto il: 15 gen 2009, 15:23

0
voti

[4] Re: accendere LED

Messaggioda Foto Utentesystem90 » 5 ott 2009, 17:20

errore mi indica qua

Codice: Seleziona tutto
--------------inizializzazione del PIC------------
#pragma config OSC=HS
#pragma config WDT=OFF
#pragma config LVP=OFF
Avatar utente
Foto Utentesystem90
0 2
 
Messaggi: 23
Iscritto il: 21 set 2009, 10:39

0
voti

[5] Re: accendere LED

Messaggioda Foto UtenteDonJ » 5 ott 2009, 17:25

system90 ha scritto:errore mi indica qua

Codice: Seleziona tutto
--------------inizializzazione del PIC------------
#pragma config OSC=HS
#pragma config WDT=OFF
#pragma config LVP=OFF

è un po' generico, non riesci a postare L'ESATTO messaggio d'errore che ti da il compilatore nel log?
è sintassi? è un comando sconosciuto? insomma sei troppo vago così
"Computers, operating systems, networks are a hot mess. They're barely manageable, even if you know a decent amount about what you're doing. Nine out of ten software engineers agree: it's a miracle anything works at all."
@fasterthanlime
Avatar utente
Foto UtenteDonJ
4.611 6 10 13
Master EY
Master EY
 
Messaggi: 2562
Iscritto il: 19 lug 2009, 22:13
Località: Croccamauria

0
voti

[6] Re: accendere LED

Messaggioda Foto Utentesystem90 » 5 ott 2009, 17:55

non so come ho fatto,ma ora funziona,grazie per la tua disponibilità
Avatar utente
Foto Utentesystem90
0 2
 
Messaggi: 23
Iscritto il: 21 set 2009, 10:39

0
voti

[7] Re: accendere LED

Messaggioda Foto UtenteDonJ » 5 ott 2009, 18:20

ah di nulla davvero Immagine

comunque sarebbe bello se capissi dove hai sbagliato..
tanto per non rifare lo stesso errore due volte
"Computers, operating systems, networks are a hot mess. They're barely manageable, even if you know a decent amount about what you're doing. Nine out of ten software engineers agree: it's a miracle anything works at all."
@fasterthanlime
Avatar utente
Foto UtenteDonJ
4.611 6 10 13
Master EY
Master EY
 
Messaggi: 2562
Iscritto il: 19 lug 2009, 22:13
Località: Croccamauria

0
voti

[8] Re: accendere LED

Messaggioda Foto Utentesystem90 » 5 ott 2009, 18:41

avevo sbagliato a mettere le parentesi,una tonda,e 2 graffe
Avatar utente
Foto Utentesystem90
0 2
 
Messaggi: 23
Iscritto il: 21 set 2009, 10:39


Torna a Firmware e programmazione

Chi c’è in linea

Visitano il forum: Nessuno e 2 ospiti