Shop OBEX P1 Docs P2 Docs Learn Events
Max7219 — Parallax Forums

Max7219

ArchiverArchiver Posts: 46,084
edited 2002-03-14 12:36 in General Discussion
Here's where I am at with my project. I am using the BS2 to control
an X-ray pulse counter. The counter is user inputted through a 9 key
keypad with the numbers 0 through 5, reset, increment, arm/disarm.
The amount of pulses needed are 50, 100, 150, ect to 500. the time
delay between pulses are also user selected, and are 5 sec, 10 sec
and 15 sec. I am using four 7 segment LED's with the MAX 7219 LED
driver. In hindsight, I should have forked out the darn money for an
LCD and used all the examples found in my books....anyway PROBLEM #1
the LED needs to display each number as it is inputted. PROBLEM #2
When the INC button is pressed, I still need the value first entered
for the amout of pulses, but the LED has to display the time
inbetween pulses. PROBLEM #3 when the pulse count reaches zero, it
needs to stop. I've included the code which I am playing with, I am
more than open to any suggestions at this point. So far when
entering the number of pulses hasn't been a problem and it has worked
up to the point of PROBLEMS 1 to 3. * indicates my changes to the
app mod code

data_n con 0
clk con 1
load con 2
decode con 9
brite con 10
switch con 12
test con 15

max_dat var word
index var nib
temp var nib
nonZ var bit
dispval var word
odd var index.bit0
*n1 var word 'first key number
*n2 var byte 'second key number
*n3 var bit 'third key number

*low 0
*low 1
*low 2
*high 15 'pin# relay is attached
'PROBLEM #1 display each digit as entered
*PULSE:
* if in3=0 then number_1 'if key 1 is pushed
* if in4=0 then number_2 'key 2 ect key 3 and 4
* if in7=0 then number_5 'key 5
* if in8=0 then number_0 'key 0
*goto pulse 'no selection...keeps looking

*NUMBER_1: 'first # in hundreds posistion
* n1=1
*goto digit_2

*NUMBER_5: 'this can only be 500 from choices
* dispval=500
*goto display 'display 500

*NUMBER_0: 'this can only be 50
* dispval=50
*goto display 'display 50

*DIGIT_2: 'can only be two choices 5 or 0
* if in7=0 then number_5Set2 'key 5 was pressed
* if in8=0 then number_0Set2 'key 0 was pressed
*goto digit_2

*NUMBER_5Set2: ' number 5 in tens posistion
* n2=5 'num_0set2 would store 0 in tens
*goto digit_3

*DIGIT_3: 'last digit will always be 0
* n3=0

*dispval=(n1*100)+(n2*10)+n3 'times the input by # posistion
*DISPLAY:
for index=0 to 7
lookup index,[noparse][[/noparse]scan,4,brite,3,decode,$1F,switch,1],max_dat
shiftout data_n,clk,msbfirst,[noparse][[/noparse]max_dat]
if odd=0 then noload
pulsout load,1
NoLoad:
next
LOOP:
gosub maxdisplay
* pause 5000 PROBLEM #2 need to select/display
* low 15 'open/close relay
* pause 200
* high 15
dispval=dispval-1 'PROBLEM #3 will not stop at 0
goto Loop

MAXDISPLAY:
nonz=0
for indx=5 to 1
shiftout data_n,clk,msbfirst,[noparse][[/noparse]index]
temp= dispval dig (index-1)
if temp=0 then skip1
nonz=1
SKIP1:
if nonz=1 OR temp<>0 OR index=1 then skip2
temp=15
SKIP2:
shiftout data_n,clk,msbfirst,[noparse][[/noparse]temp]
pulseout Load,5
next
return

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-03-14 12:36
    Could anyone show me how to 'boost' the voltage and amp output of the
    Max7219? I have read the data sheet but I am not sure exactly how to hook
    up a seperate driver chip. I am looking for 7-8 volts at 60mA per segment.
    Thanks, Dan
Sign In or Register to comment.