picaxe.free.fr
Interface avec un M5450 Soumis par Administrator 29-08-2009 Dernière mise à jour : 29-08-2009
Le circuit M5450 permet de piloter 35 LEDs individuelles ou jusqu'à 5 afficheurs 7-segments, à partir de seulement 2 entrées : Clock et Data IN.
Il s'interface très facilement avec un picaxe 08M, par exemple.
' M5450 + 4 digit display ' '
+V 1 U 8 0V
' GND - 10K 2 7 (0) to CLOCK IN '
NC 3 6 (1) to DATA IN
'
NC 4 5 NC
' ' b1 b0 b3 b2 b5 b4 b7 b6 b9 b8 b11 b10 b13 b12 ' --w0-- --w1-- --w2-- --w3-- --w4-- --w5--- --w6--' ' picaxe.free.fr
symbol CLK = 0 'out 0 symbol DTA = 1 'out 1 symbol tmp
= b13
symbol speed = w5 symbol digit = b12 symbol pattern = b9 symbol sb
= b8
symbol D0 = b0 symbol D1 = b1 http://picaxe.free.fr
Propulsé par Joomla!
Généré: 29 October, 2018, 22:46
picaxe.free.fr
symbol D2 = b2 symbol D3 = b3 symbol T = w3 symbol T1 = w2 symbol DELAY = 3
output CLK output DTA
setfreq m4
speed = 1234 gosub Display pause 1000
main: max4: random speed if speed > 9999 then max4 gosub Display pause 1000 goto main
Send_Clock: pulsout CLK, DELAY return
Send_Byte: lookup digit, ($FC,$60,$DA,$F2,$66,$B6,$BE,$E0,$FE,$F6,$00,$02,$01,$FF), pattern for tmp = 1 to 8 sb = pattern & $80 http://picaxe.free.fr
Propulsé par Joomla!
Généré: 29 October, 2018, 22:46
picaxe.free.fr
low DTA if sb = 0 then bit_is_low high DTA bit_is_low: pulsout CLK, DELAY pattern = pattern * 2 next return
Clear_Display: high DTA gosub Send_Clock low DTA for tmp = 1 to 4 gosub Send_Byte next low DTA for tmp = 1 to 3 pulsout CLK, DELAY next pause 50 return
Display: D0 = speed / 1000 T1 = 1000 * D0 T = speed - T1' T = speed - 1000 * D0 D1 = T / 100 T1 = 100 * D1 T = T - T1
' T = T - 100 * D1
D2 = T / 10 T1 = 10 * D2 http://picaxe.free.fr
Propulsé par Joomla!
Généré: 29 October, 2018, 22:46
picaxe.free.fr
D3 = T - T1
' D3 = T - 10 * D2
if speed > 999 then D0on D0 = 10 D0on: if speed > 99 then D1on D1 = 10 D1on: if speed > 9 then D2on D2 = 10 D2on: high DTA gosub Send_Clock low DTA digit = D0 gosub Send_Byte digit = D1 gosub Send_Byte digit = D2 gosub Send_Byte digit = D3 gosub Send_Byte low DTA for tmp = 1 to 3 pulsout CLK, DELAY next pause 50 return
http://picaxe.free.fr
Propulsé par Joomla!
Généré: 29 October, 2018, 22:46