
Originally Posted by
isaac
can only hold up to 5 digits so 12345 displays ok but when its 123456
this is grater than a word variable can hold so i need so help in how to do this i am following all the advice given but still lost
Regards
ISAAC
As I said in the other post on the basically the same subject, think fingers and hands. A WORD (hand) can only 'hold' 5 digits (fingers), you can count up to 10,000 but you can't count up to 100,000...
So, two words (hands) to hold your data, one word (hand) holds 0-9999 the other word (hand) holds the places above 9999.
Code:
max_displow = 0 : max_disphigh = 0
Again: max_displow=maxdisplow+1
if max_displow>999 then maxdisplow=maxdisplow-1000 : maxdisphigh=maxdisphigh+1
Gosub Display : Pause 150 : goto again
Display: For Position=1 to 6 step -1 : Register=Position
R_Val=Max_Disphigh Dig Digit : if position>3 then r_val=max_displow dig digit
Gosub Transfer : Digit=Digit+1 : Next Position : Return
Transfer: Shiftout Dta,Clk,msbfirst,[Register,R_Val] : load=1 : load=1
load=0 : return
But again, get PBPL and LONGs working and it'll be a bit easier...
Bookmarks