Counting on an LED 7 Segment Display

Relayer

New Member
I'm trying to multiplex three 7 segment LED displays to provide a counting feature. On a side note, please don't mention using display drivers for driving the displays because a.) I want to keep the parts to a minimum, and b.) I already am able to get the PICAXE to display a static value simply using the outputs as GND and Port C pins as the common anode.

Sample code which demonstrates multiplexing LED displays on a PICAXE is very elusive. I see posts in this forum saying to search for the code because it's well documented, which I did, only to find nothing that clues me to what I want to know.

I managed to come across this code to attempt to make a single digit count from 0 to 9. It is excerpted from code written by a Daniel Wright. I'm using a PICAXE 28x1

Code:
Initialize:

data 0,(%00111111,%00000110,%01011011,%01001111,%01100110,%01101101,%01111101,%00000111,%01111111,%01101111) ‘ save array 1 values in EEPROM
let dirsc=%11111111

main:

for b0 = 0 to 9 	‘start ones loop
read b0,b1 		‘read ones value of array 1
let pinsc = %11111111
let pins= not b1
pause 1000
;let pins = %00000000
next b0 		‘next character ones loop

goto main

end
A couple notes first:

  • This is slightly modified code from the original
  • I'm using Common Anode LED Displays
  • the "not b1" term in the code is used because of the Common Anode LEDs

After programming the PICAXE, I get a "0" in my LED Display. It pauses for a little over one second, then the display blanks out, never to reappear again until I reset the device.

Thinking the zero in the display was a fluke, I transposed the first two values in the DATA statement so that a "1" will appear for a second. A "1" did appear for a little over a second and then the display blanked out as usual, never to show anything again.

What gives?

I don't have a schematic to show, but I wired the LED segments (a-g) to pins 21-27 (0-6 of the Output pins) in the proper order to match the bits in the DATA statement.

The common anode for just a single digit right now is connected to Pin 11 (Input/Output 0). Therefore, when I set all Port C pins to Output and set to High, the LED digit should have it's common anode set to +5V as required.

My guess is the for loop runs through only the first pass (doesn't even count to "1") and then the program quits.
 

Relayer

New Member
Quickest self resolution????

Not two minutes after I posted this, I discovered my problem.

I have no idea why I didn't find any info about this, but removing the programming cable allowed the PICAXE to continue working as expected.

Is there any way to leave the programming cable connected during code testing?
 

BeanieBots

Moderator
You should be able to run with or without the cable.
Your problem and the fact that it is different without the cable suggests that you have a wiring fault. Double check the most likely which is a floating reset line. If it's not that, then double check your download circuit.
 
Top