Hi guys,

i'm experimenting with some 7 segment displays and my 16F84A.

I can get fixed values to work ( like portb=$40 and b5=5 and lookup the value )
But when i try to increment b5 and output the result i get strange readings...

What is wrong ?
Must i do this in a different way ?

Here's the code:


'7 segment display test
'device 16F84
'7 seg portb
'1 button porta.0
'1 button porta.1

init:
'a var portb.0
'b var portb.1
'c var portb.2
'd var portb.3
'e var portb.4
'f var portb.5
'g var portb.6
'dp var portb.7

b5 var word

DEFINE OSC 4

input porta
TRISB = $80

portb=$40
pause 1500

start:

b5=5

loop:

if porta.1 =1 then
b5=b5+1
Lookup b5, [$40, $79, $24, $30, $19, $12, $02, $78, $00, $18], b5
portb=$ff
portb=b5
pause 300
endif

if porta.0 =1 then
b5=b5-1
Lookup b5, [$40, $79, $24, $30, $19, $12, $02, $78, $00, $18], B5
portb=$ff
portb=b5
pause 300
endif

if (porta.0=0) and (porta.1=0) then
Lookup b5, [$40, $79, $24, $30, $19, $12, $02, $78, $00, $18], B5
portb=$ff
portb=b5
pause 300
endif

goto loop


Thanks