Cos'è ElectroYou | Login Iscriviti

ElectroYou - la comunità dei professionisti del mondo elettrico

Un pin difettoso?...

Tipologie, strumenti di sviluppo, hardware e progetti

Moderatore: Foto UtentePaolino

0
voti

[1] Un pin difettoso?...

Messaggioda Foto UtenteTricka90 » 1 ott 2013, 12:36

Col mio PIC 16F876, del quale allego il datasheet (http://ww1.microchip.com/downloads/en/d ... 30292c.pdf), sto provando a far accendere un LED sulla porta RA5. Inutile dire che il LED non vuole accendersi.
Nel programma, ho ovviamente impostato TRISA = 0 e PORTA.RA5 = 1.
Sul ds ho visto che RA5 può funzionare anche come porta analogica, dunque ho impostato tutto come digitale con ADCON1 = 0b00000110 e ADCON1 = 0.
Ancora niente.
Ho visto poi che RA5 può anche essere usata come "slave select for the synchronous serial port", quindi ho provato a disattivare questa funzione con PIE1.SSPIE = 0 e con SSPCON.SSPEN = 0.
Niente da fare, il LED rimane spento!
Pensate che stia sbagliando qualcosa? O può essere che il pin sia semplicemente difettoso? Vi è mai capitato?
Avatar utente
Foto UtenteTricka90
662 1 6 10
Expert
Expert
 
Messaggi: 627
Iscritto il: 1 lug 2013, 15:53

0
voti

[2] Re: Un pin difettoso?...

Messaggioda Foto UtenteDryden » 1 ott 2013, 12:43

prova a scrivere tutta la porta e vedi se funziona...

porta = 0b111111

quel problema può sorgere a causa del RMW.

A me un 12f683 mi ha fatto diventare scemo, infatti per ovviare uso solo PIC18!
Avatar utente
Foto UtenteDryden
20 4
New entry
New entry
 
Messaggi: 97
Iscritto il: 1 gen 2011, 14:37
Località: Bolzano

0
voti

[3] Re: Un pin difettoso?...

Messaggioda Foto UtenteTricka90 » 1 ott 2013, 13:08

GIà provato, niente da fare purtroppo, si accendono tutte tranne RB5!
Per curiosità, cos'è l' RMW? :-)
Avatar utente
Foto UtenteTricka90
662 1 6 10
Expert
Expert
 
Messaggi: 627
Iscritto il: 1 lug 2013, 15:53

1
voti

[4] Re: Un pin difettoso?...

Messaggioda Foto Utentec1b8 » 1 ott 2013, 22:12

Ed il registro CMCON (bit 0:2) come è impostato?
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

[5] Re: Un pin difettoso?...

Messaggioda Foto UtenteTricka90 » 1 ott 2013, 23:07

Ciao c1b8!
Il registro CMCON? Non mi risulta che i PIC della famiglia 16F87X abbiano questo registro, sul datasheet non compare proprio!
Avatar utente
Foto UtenteTricka90
662 1 6 10
Expert
Expert
 
Messaggi: 627
Iscritto il: 1 lug 2013, 15:53

0
voti

[6] Re: Un pin difettoso?...

Messaggioda Foto Utentec1b8 » 1 ott 2013, 23:12

Azz... chiedo scusa... :oops: :oops: ho guardato il datasheet del 16F876A... quella A finale mi ha proprio fregato! :oops: :oops:
Perdona!
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

[7] Re: Un pin difettoso?...

Messaggioda Foto UtenteTricka90 » 2 ott 2013, 8:29

Ma stai tranquillo! Mi è servito per ricordare che sei anche tu un umano, e non un dio onniscente nel campo dei PIC! :lol:
Credo proprio allora che sia davvero difettoso il pin...vi è mai capitato o sarebbe una cosa assurda??
Avatar utente
Foto UtenteTricka90
662 1 6 10
Expert
Expert
 
Messaggi: 627
Iscritto il: 1 lug 2013, 15:53

1
voti

[8] Re: Un pin difettoso?...

Messaggioda Foto UtenteShockwaver » 2 ott 2013, 10:57

Tricka90 ha scritto:ho impostato tutto come digitale con ADCON1 = 0b00000110 e ADCON1 = 0

???
Riporti ADCON1 a 0 dopo averlo giustamente impostato a 6? ?%
Anyone who has never made a mistake has never tried anything new
Two things are infinite: universe and human stupidity, and I'm not sure about the former
You did not really understand something unless you can explain it to your grandmother
A. Einstein
Avatar utente
Foto UtenteShockwaver
770 1 5 11
Expert
Expert
 
Messaggi: 859
Iscritto il: 3 mar 2010, 18:56

0
voti

[9] Re: Un pin difettoso?...

Messaggioda Foto UtenteTricka90 » 2 ott 2013, 13:41

Shockwaver ha scritto:???
Riporti ADCON1 a 0 dopo averlo giustamente impostato a 6? ?%


Nono scusami, intendevo ADCON0 = 0, ho solo scritto male ma nel programma è giusto :mrgreen:
Avatar utente
Foto UtenteTricka90
662 1 6 10
Expert
Expert
 
Messaggi: 627
Iscritto il: 1 lug 2013, 15:53

0
voti

[10] Re: Un pin difettoso?...

Messaggioda Foto UtenteTricka90 » 3 ott 2013, 9:46

Ragazzi aspettate, provando tutti i pin sulla porta A ho notato che anche RA4 non funziona!!!
Per ora lasciamo perdere un attimo RA5, che probabilmente è davvero difettoso.
RA4, secondo il datasheet può essere usato come clock input del timer 0.
Ho però disabilitato i relativi bit in OPTION_REG che adesso è impostato come OPTION_REG = 0b100000010 (sono attivi solo RBPU e il prescaler perché nel programma mi serve il Timer0. Come mai RA4 non funziona? Devo impostare qualcos'altro?
Avatar utente
Foto UtenteTricka90
662 1 6 10
Expert
Expert
 
Messaggi: 627
Iscritto il: 1 lug 2013, 15:53

Prossimo

Torna a Realizzazioni, interfacciamento e nozioni generali.

Chi c’è in linea

Visitano il forum: Nessuno e 11 ospiti