programming two(or more) 7-segment leds with pbasic2.5
FarNas
Posts: 3
hi im rather new to basic stamps and their programming, i was working on a project to create a simple clock and i stumbled upon the problem of driving two 7-segment led displays at once, with a pic16c57c. i managed to multiplex them and i think i have the wiring correct, but i cant seem to figure out how to control each digit separately through the code (using pbasic 2.5), i know i must be missing something small and simple, but i cant seem to figure it out. i'd appreciate any help, thanks .
Comments
You can see how this is done with two dice patterns in the old Parallax application notes for the BS1. StampWorks shows how to do it with 7-segment displays and explains why it's not very practical (in most situations) to do this in PBASIC.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
·· Speaking of multiplexing, in a project you did for the StampWorks kit, you use the MAX7219 with 4 7-seg displays.· Your schematic doesn't show any resistors on the segments of the display, but the projects are all presumably written for the NX-1000 board, so are they assumed to be there?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Knight Designs
324 West Main Street
P.O. Box 97
Montour Falls, NY 14865
(607) 535-6777
Business Page:·· http://www.knightdesigns.com
Personal Page:··· http://www.lightlink.com/dream/chris
Designs Page:··· http://www.lightlink.com/dream/designs
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
'{$STAMP BS2}
'{$PBASIC 2.5}
index VAR Nib
OUTH = %00000000
DIRH = %11111111
FOR B1 = 0 TO 9
B0 = B1
GOSUB value
B0 = index
HIGH 0
PAUSE 1000
NEXT
' BAFG.CDE
value: LOOKUP index, [noparse][[/noparse]%01110011,
%00100100,
%00100001,
%01000011,
%10000001,
%10000000,
%00110011,
%00000000,
%00000001,
%00010000], outh
return
DIRH=%00000000
END
im using either HIGH 0 or HIGH 1 to tell which digit will be on. but one weird thing happens in this particular count, for displaying the numbers 2,3,4, and 7 (index values are 2, 3, 4, 7 as well) the A segment led stays off for sum reason, so 7 looks like a 1, when in displaying other numbers like 6, the A segment works fine....
thanks for your help so far, jon.
And you really want to break yourself of the habit of using internal variable names; this habit will ultimately lead to bugs that you'll tear your hair out trying to track down.· For example, you've declared a variable called idx and are using B0 in the programming.· What you may not recognize is that (due to the way the compiler works) that idx and B0 occupy the same RAM address.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA