Vidi covek stvarno napisa program. :)
Evo moje izmene:
Code:
Code:
'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : NELE *
'* Notice : Copyright (c) 2010 fu*k copyright *
'* : All Rights Reserved *
'* Date : 9/26/2010 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
b0 var byte
jedinice var byte
desetice var byte
stotine var byte
brojac var word
zadatibr var word
maskiranacifra var byte
i var byte
temp var bit
TRISA=%11111
TRISB=0
TRISC=%00000001
b0=0
brojac=0
temp=0
main:
Button porta.3,0,1,1,B0,1,uvecajjedinice
Button porta.4,0,1,1,B0,1,uvecajdesetice
Button porta.5,0,1,1,B0,1,uvecajstotine
Button porta.0,0,1,1,B0,1,start
goto prikazibr
goto main
uvecajjedinice:
jedinice=jedinice+1
if jedinice>9 then jedinice=0
b0=0
zadatibr = jedinice + desetice*10 + stotine *100
goto prikazibr
uvecajdesetice:
desetice=desetice+1
if desetice>9 then desetice=0
b0=0
zadatibr = jedinice + desetice*10 + stotine *100
goto prikazibr
uvecajstotine:
stotine=stotine+1
if stotine>9 then stotine=0
b0=0
zadatibr = jedinice + desetice*10 + stotine *100
goto prikazibr
prikazibr:
for i = 0 to i = 4 step 1 'ovde sam stavio for da prikaze broj nekoliko puta da bi se cifre bolje videle :)
lookup jedinice,[$3F,$06,$5B,$4F,$66,$6D,$7D,$07,$7F,$6F],maskiranacifra
portb = maskiranacifra
high portc.5
pause 1
low portc.5
lookup desetice,[$3F,$06,$5B,$4F,$66,$6D,$7D,$07,$7F,$6F],maskiranacifra
portb = maskiranacifra
high portc.6
pause 1
low portc.6
lookup stotine,[$3F,$06,$5B,$4F,$66,$6D,$7D,$07,$7F,$6F],maskiranacifra
portb = maskiranacifra
high portc.7
pause 1
low portc.7
NEXT i
goto main
start:
if brojac<zadatibr then
high portc.4
else
low portc.4
goto main
endif
if portc.0 = 0 AND temp = 1 then brojac = brojac +1
if portc.0 = 1 then temp = 1
if portc.0 = 0 then temp = 0
Button porta.2,0,1,1,B0,1,pauza
Button porta.1,0,1,1,B0,1,stopp
b0=0
goto start
pauza:
low portc.4
Button porta.0,0,1,1,B0,1,start
Button porta.1,0,1,1,B0,1,stopp
b0=0
goto pauza
stopp:
low portc.4
b0=0
'ovde ako hoces ubaci brojac = 0 da ga resetujes
goto main
end
Mislim da ima jos neka greska, ali proveri prvo ovako. Pozdrav...