beste mensen ik ben bezig met het maken van een biljart telbordje ik kan al een beetje programmeren maar deze microcontroller is mijn eerste die ik moet programmeren
deze controller zou 8 7segment led displays moeten aansturen gemultiplext. hier is het programma dat ik al gemaakt heb de tijden zijn voor de moment wat trager want ik kan zo snel ni zien.
Dim W1 as byte
Dim W2 as byte
Dim W3 as byte
Dim R1 as byte
Dim R2 as byte
Dim W4 as byte
Dim W5 as byte
Dim W6 as byte
Dim S1 as byte
Dim S2 as byte
Dim S3 as byte
Dim S4 as byte
Dim S5 as byte
Dim S6 as byte
Dim S7 as byte
Dim S8 as byte
optellen:
waitms 500
If P3 = &B11111101 then W1 = W1 + 1
if P3 = &B11110111 then W4 = W4 + 1
if P3 = &B11101111 then R1 = R1 + 1
if R1 = 10 then R2 = R2 + 1
if R1 = 10 then R1 = 0
if W4 = 10 then W5 = W5 + 1
if W4 = 10 then W4 = 0
if W5 = 10 then W6 = W6 + 1
if W5 = 10 then W5 = 0
If W1 = 10 then W2 = W2 + 1
if W1 = 10 then W1 = 0
if W2 = 10 then W3 = W3 + 1
if W2 = 10 then W2 = 0
aftellen:
if P3 = &B11111110 and W1 > 0 then W1 = W1 - 1
if P3 = &B11111011 and W4 > 0 then W4 = W4 - 1
if P3 = &B11011111 and R1 > 0 then R1 = R1 - 1
if P3 = &B11111110 and W1 = 0 and W2 > 0 then W1 = 9
if P3 = &B11111110 and W1 = 0 and W2 = 0 then W1 = 9
if P3 = &B11111110 and W1 = 0 and W2 = 0 and W3 > 0 then W1 = 9
if P3 = &B11111110 and W1 = 0 and W2 = 0 then W1 = 9
areset:
if P3 = &B01111111 then W1 = 0
if P3 = &B01111111 then W2 = 0
if P3 = &B01111111 then W3 = 0
if P3 = &B01111111 then W4 = 0
if P3 = &B01111111 then W5 = 0
if P3 = &B01111111 then W6 = 0
if P3 = &B01111111 then R1 = 0
if P3 = &B01111111 then R2 = 0
multiplex:
waitms 500
S1 = W1
P0 = not S1
waitms 500
S2 = W2 + 16
P0 = not S2
waitms 500
S3 = W3 + 32
P0 = not S3
waitms 500
S4 = W4 + 48
P0 = not S4
waitms 500
S5 = W5 + 64
P0 = not S5
waitms 500
S6 = W6 + 80
P0 = not S6
waitms 500
S7 = R1 + 96
P0 = not S7
waitms 500
S8 = R2 + 112
P0 = not S8
waitms 500
S1 = 0
S2 = 0
S3 = 0
S4 = 0
S5 = 0
S6 = 0
S7 = 0
S8 = 0
goto optellen
end
thx anyway
Okee zonder onaardig te doen, maarre wat is de nu de vraag ?
Daarnaast, probeer in je code wat de functie van een regel is erbij te remmen, het maakt je code beter leesbaar voor jezelf en anderen. Bij het compileren knikkert de compiler alle REM regels (of wat er achter een ' staat) er toch uit dus je code wordt er niet logger door.