Hello!
To understand the operation of the PIC, I tried to implement a
counter with a display double but I can not get see well the numbers.
I use Picaxe 28x1 for make it.
Where is the error?
Thanks. Bye Giacomo
another testing..
To understand the operation of the PIC, I tried to implement a
counter with a display double but I can not get see well the numbers.
I use Picaxe 28x1 for make it.
Where is the error?
Thanks. Bye Giacomo
Code:
let b0 = 0
let b1 = 0
let pins =%00000000
low portc 7
low portc 6
low portc 5
low portc 4
main:
'if portc pin0 = 1 then goto incrementa
for b2 = 0 to 99
let b2 = b2+1
gosub contare
pause 500
gosub visualizza
next b2
end
contare:
let b0 = b0 + 1
if b0 > 9 then let b0 = 0
b1 = b1 +1
end if
if b1 > 9 then let b1 = 0
end if
return
incrementa:
if b0 > 9 then goto decina
let b0 = b0+1
goto main
decina:
let b0 = 0
let b1 = b1 +1
if b1>9 then goto azzero
goto main
azzero:
let b0 = 0
let b1 = 0
goto main
visualizza:
gosub decine
pause 2
gosub unita
pause 2
return
unita:
high portc 7
high portc 6
low portc 5
high portc 4
if b0 = 0 then goto zero
if b0 = 1 then goto uno
if b0 = 2 then goto due
if b0 = 3 then goto tre
if b0 = 4 then goto quattro
if b0 = 5 then goto cinque
if b0 = 6 then goto sei
if b0 = 7 then goto sette
if b0 = 8 then goto otto
if b0 = 9 then goto nove
zero:
high 0
high 1
high 2
high 3
high 4
high 5
low 6
return
spento:
low 0
low 1
low 2
low 3
low 4
low 5
low 6
return
uno:
low 0
high 1
high 2
low 3
low 4
low 5
low 6
return
due:
high 0
high 1
low 2
high 3
high 4
low 5
high 6
return
tre:
high 0
high 1
high 2
high 3
low 4
low 5
high 6
return
quattro:
low 0
high 1
high 2
low 3
low 4
high 5
high 6
return
cinque:
high 0
low 1
high 2
high 3
low 4
high 5
high 6
return
sei:
high 0
low 1
high 2
high 3
high 4
high 5
high 6
return
sette:
high 0
high 1
high 2
low 3
low 4
low 5
low 6
return
otto:
high 0
high 1
high 2
high 3
high 4
high 5
high 6
return
nove:
high 0
high 1
high 2
high 3
low 4
high 5
high 6
return
decine:
high portc 7
low portc 6
high portc 5
high portc 4
if b1 = 0 then goto zero1
if b1 = 1 then goto uno1
if b1 = 2 then goto due1
if b1 = 3 then goto tre1
if b1 = 4 then goto quattro1
if b1 = 5 then goto cinque1
if b1 = 6 then goto sei1
if b1 = 7 then goto sette1
if b1 = 8 then goto otto1
if b1 = 9 then goto nove1
zero1:
high 0
high 1
high 2
high 3
high 4
high 5
low 6
return
spento1:
low 0
low 1
low 2
low 3
low 4
low 5
low 6
return
uno1:
low 0
high 1
high 2
low 3
low 4
low 5
low 6
return
due1:
high 0
high 1
low 2
high 3
high 4
low 5
high 6
return
tre1:
high 0
high 1
high 2
high 3
low 4
low 5
high 6
return
quattro1:
low 0
high 1
high 2
low 3
low 4
high 5
high 6
return
cinque1:
high 0
low 1
high 2
high 3
low 4
high 5
high 6
return
sei1:
high 0
low 1
high 2
high 3
high 4
high 5
high 6
return
sette1:
high 0
high 1
high 2
low 3
low 4
low 5
low 6
return
otto1:
high 0
high 1
high 2
high 3
high 4
high 5
high 6
return
nove1:
high 0
high 1
high 2
high 3
low 4
high 5
high 6
return
another testing..
Code:
for b2 = 0 to 99
let b2 = b2+1
gosub contare
for b5= 1 to 125 '1sec pause cicle 125x8ms =1sec
gosub visualizza
next b5
next b2
.
.
visualizza:
gosub decine
pause 4 '4ms delay between first diplay and second display
gosub unita
pause 4 '4ms delay between second diplay and first display
return