PDA

View Full Version : Multiplex Display with count comand



mdaweb
- 10th October 2005, 20:43
Helo All,

Multiplex 3 Display 7 Seg. blink when I use the command count.

@ device pic16F628A, wdt_off, pwrt_on, mclr_off, bod_off, lvp_off, protect_off
TRISB = 0 'set PORTB pins as outputs 0, Input 1
TRISA = %00001 'set PORTA pins as inputs 1, Output 0
CMCON = 7 'set PortA = digital I/O
VRCON = 0 ' Voltage reference disabled

'Decimal Common Anode
Zero CON 192 'abcdef
One CON 249 'bc
Two CON 164 'abdeg
Three CON 176 'abcdg
Four CON 153 'bcfg
Five CON 146 'acdfg
Six CON 130 'acdefg
Seven CON 248 'abc
Eight CON 128 'abcdefg
Nine CON 144 'abcfg

'Variables
ENTRADA VAR PORTA.0
FREQ var WORD
KM var word
x var byte


MEDE:

COUNT ENTRADA,1000,FREQ 'With count display blink
' freq = 430 'without normal
KM = Freq / 4

MOSTRA:


For X = 0 to 2 'number of digits 'three in this case

Display:

LookUp (KM DIG (X)),[Zero,One,Two,Three,Four,Five,Six,Seven,Eight,Nine],PORTB

if X = 0 then
PORTA = 2 ' %00010 2 turn ones display on
pauseus 500 ' wait for a while
PORTA.1 = 0 ' %00001 $00 turn all displays off
eNDIF

if X = 1 then
if KM >= 10 then
PORTA = 4 ' %00100 4 turn ones display on
pauseus 500 ' wait for a while
PORTA.2 = 0 ' %00001 $00 turn all displays off
endif
ENDIF

if X = 2 then
if KM >= 100 then
PORTA = 8 ' %01000 8 turn ones display on
pauseus 500 ' wait for a while
PORTA.3 = 0 ' %00001 $00 turn all displays off
endif
ENDIF
Next X

Goto MEDE


As it resolve that problem?

mister_e
- 11th October 2005, 08:33
you should use something else than Count.

Look at the following link...
http://www.picbasic.co.uk/forum/showthread.php?t=1044

mdaweb
- 11th October 2005, 14:54
Ok but that codigo does not function, where and used to variavel ClockInput var PORTA.4 ?

mdaweb
- 16th October 2005, 04:09
Ok Mister_E, Work Fine, I obtained convert to frequencia for Kilometer using the Count_display.bas Thanks!

Best regards,
<!-- MDAWEB -->