I mean when i write 2-digit , 3-digit or 4-digit number, the last lead digit to be unit, the one before last to be tenth, and so ...the first one to be thousanth....
I mean when i write 2-digit , 3-digit or 4-digit number, the last lead digit to be unit, the one before last to be tenth, and so ...the first one to be thousanth....
Can you post the code you have with a schematic showing how you have the displays wired?
I had a problem like this when I had this lab in school. Couple years to follow a simple thought process of how to write it could be changed.
A method you can try is like this:
1. input your data into 1st 7seg
2. take the old data from 1st 7seg and put into 2nd 7seg.
3. so forth
Doing this you will have 3 var that will store the information that does travel from one 7seg to the next. That is something you have to figure for you program. Draw it out then write it out.
i changed some things, but there is something wrong again....here is my code:
INCLUDE "modedefs.bas"
Flag Var Bit
Key Var Byte
Resultat Var Byte
s var byte ' KOLKO PUTI SYM NATISNAL KLAVIATURATA
W VAR WORD ' tova e nabranoto chislo ot klaviaturata
BCD1 VAR BYTE
BCD2 VAR BYTE
BCD3 VAR BYTE
BCD4 VAR BYTE
symbol Segmenti = PORTC
symbol razriad = PORTA
i Var Byte
n Var Byte
TRISA = 0
TRISB = %11110001
trisc = 0
INTCON = %10000000
W = 0
Resultat = 0
S = 0
bcd1 = 0
bcd2 = 0
BCD3 = 0
bcd4 = 0
Main:
Gosub ScanKeys
if resultat = 11 then TOGGLE PORTA.4
if resultat = 10 THEN TOGGLE PORTA.5
IF resultat = 12 then Main
SELECT CASE S
CASE 0
segmenti = $3F '0
razriad = 1 'LSDigit
GOTO MAIN
CASE 1
w= resultat
bcd1 = resultat
CASE 2
bcd2 = resultat
w = bcd1*10 + bcd2
CASE 3
bcd3= resultat
w = bcd1*100 + bcd2*10 + bcd3
CASE 4
bcd4 = resultat
w = bcd1*1000 + bcd2*100 + bcd3*10 + bcd1
CASE ELSE
S= 0
GOTO MAIN
END SELECT
gosub pokaji
ScanKeys:
Key=0
PORTB=%1000
gosub Redica
if Flag=1 then Kolona1
PORTB=%0100
gosub Redica
if Flag=1 then Kolona2
PORTB=%0010
gosub Redica
if Flag=1 then Kolona3
Resultat=12
return
Kolona1:
s = s+1
lookup Key,[1,4,7,10],Resultat
return
Kolona2:
s = s+1
lookup Key,[2,5,8,0 ],Resultat
return
Kolona3:
s = s+1
lookup Key,[3,6,9,11],Resultat
return
Redica:
Flag=1
if PORTB.4=1 then return
Key=Key+1
if PORTB.5=1 then return
Key=Key+1
if PORTB.6=1 then return
Key=Key+1
if PORTB.7=1 then return
Key=Key+1
Flag=0
return
pokaji:
For i = 0 To s
n = W Dig i
GoSub izvlechi
Next i
Return
izvlechi:
Lookup n, [$3f, $06, $5b, $4f, $66, $6d, $7d, $07, $7f, $6f], Segmenti
razriad = Dcd i
Return
end
and here is a sheme
Last edited by evmav; - 3rd February 2006 at 15:30.
i had the same problem a couple of days ago one solution is to flag the number of keypad hits then after every flag perform an operation i used flags from 1 to 4 then save the keypad hits in 4 variables then do an operation each and every flags!!! for example to solve a digit or two flag1 which is keypad hit number one = hit1, flag2= (hit1*10)+hit2 then flag3=(hit1*100)+(hit2*10)+hit3............and so on and so forth
Hello,
It publishes the complete code to be able to help you.
Greetings
Leonard
Originally Posted by leisryan
Bookmarks