Flash parasite sur port sorties

jojojo

Senior Member
Bonjour.

Je bute sur un truc casse-pieds.

Il s'agit d'une bête télécommande 10 canaux.

J'ai, systématiquement quelques "flash parasites", à l'activation d'une commande.
Le hardware est soigné 'découplages, et tout et tout). J'en déduit donc un souci soft. Mais, lequel ?

Le code :
Code:
	#picaxe 40X2
	Setfreq M16
	let dirsA=%00010110
	let dirsB=%11111111
	let dirsC=%00000011
	let dirsD=%00000000
	
		'Recup dernière config
	Read 0,b0
	PinsB=b0
	b0=0
	Read 1,b0
	b0=b0 AND 3
	PinsC=b0
	
	
Do
	


	
	w0=0:w1=0:w2=0:w3=0
	RFin A.0,b0,b1,b2,b3,b4,b5,b6,b7		'Protocole Manchester



	If b7=0 Then
		If PinC.3=1 Then				'Test etat switch
			Toggle B.0
			Goto WriteEeprom			'fugitif ou bistable
			Exit					'et mémo config
		Else
			Toggle B.0
			Pause 200
			Toggle B.0
			Exit
		End If
		
	End If
	If b7=1 Then
		If PinC.2=1 Then
			Toggle B.1
			Goto WriteEeprom
			Exit
		Else
			Toggle B.1
			Pause 200
			Toggle B.1
			Exit
		End If
		
	End If
	If b7=2 Then
		If PinC.4=1 Then
			Toggle B.2
			Goto WriteEeprom
			Exit
		Else
			Toggle B.2
			Pause 200
			Toggle B.2
			Exit
		End If
		
	End If
	If b7=3 Then
		If PinC.5=1 Then
			Toggle B.3
			Goto WriteEeprom
			Exit
		Else
			Toggle B.3
			Pause 200
			Toggle B.3
			Exit
		End If
		
	End If
	If b7=4 Then
		If PinC.6=1 Then
			Toggle B.4
			Goto WriteEeprom
			Exit
		Else
			Toggle B.4
			Pause 200
			Toggle B.4
			Exit
		End If
		
	End If
	If b7=5 Then
		If PinC.7=1 Then
			Toggle B.5
			Goto WriteEeprom
			Exit
		Else
			Toggle B.5
			Pause 200
			Toggle B.5
			Exit
		End If
	
	End If
	If b7=6 Then
		If PinD.4=1 Then
			Toggle B.6
			Goto WriteEeprom
			Exit
		Else
			Toggle B.6
			Pause 200
			Toggle B.6
			Exit
		End If
	
	End If
	If b7=7 Then
		If PinD.5=1 Then
			Toggle B.7
			Goto WriteEeprom
			Exit
		Else
			Toggle B.7
			Pause 200
			Toggle B.7
			Exit
		End If
			
	End If
	
	If b7=8 Then
		If PinD.6=1 Then
			Toggle C.1
			Goto WriteEeprom
			Exit
		Else
			Toggle C.1
			Pause 200
			Toggle C.1
			Exit
		End If
		
	End If
	If b7=9 Then
		If PinD.7=1 Then
			Toggle C.0
			Goto WriteEeprom
			Exit
		Else
			Toggle C.0
			Pause 200
			Toggle C.0
			Exit
		End If
	
	End If
Loop



WriteEeprom:
Write 0,PinsB
Write 1,PinsC
Return

Code TX:

Code:
'Sortie en cmd  Radiometrix  869.5Mhz



	#picaxe 14M2
	Let dirsC=%010000
	Let dirsB=%000110
	Symbol LED=C.4
	Symbol ENTX=B.1
				
pause 5						'stab alim ADC
							'temps de décharge 2.2µ, 2 ms max
Do
	
	
	Readadc b.3,b0
					'U fct touche, cf schema

	If b0>158 Then 
		b1=10
		Exit
	End If
		
	If b0 >147 Then
		b1=1
		Exit
	End If
	If b0	>137 Then
		b1=4
		Exit
	End If
	If b0 >126 Then
		b1=7
		Exit 
	End If
	If b0 >117 Then
		b1=0
		Exit 
	End If
	
	If b0>111 Then
		b1=2
		Exit 
	End If
	If b0 >105 Then
		b1=5
		Exit 
	End If
	If b0>99 Then
		b1=8
		Exit
	End If
	If b0>93 Then
		b1=11
		Exit
	End If
	If b0 >90 Then
		b1=3
		Exit
	End If	
	If b0 >86 Then
		b1=6
		Exit
	End If	
	If b0 >80 Then
		b1=9
		Exit
	End If

Loop	



	

	
	
	High LED
	High ENTX
	for b5=1 to 5	'Init TX cf doc Radiometrix
	High B.2		'+/- 100ms 
	pause 10
	Low B.2
	Pause 10
	next b5
	
	
	
	RFout B.2,(1,1,1,1,1,1,1,b1)	
															
	
	Low ENTX
	Low LED
Les flash se produisent surtout sur les pins B0, B1, et B2, mais, c'est plutôt aléatoire ... Quelques ms, juste visible à l’œil, sur les led's de contrôle.

Quiqualabonneidée ?

Georges.
 

jojojo

Senior Member
Grrr ! L'andouille ! Gosub WriteEEprom, bien sûr.

Mais ... Pareil, voir pire. :mad:

Edit: A y est !

Deux Do et deux Loop, bien sûr ! Sinon, les exit renvoient après le premier loop, et cata ...

Là, c'est nickel.
 
Top