Count down clock
 
Notifications
Clear all

Count down clock

29 Posts
8 Users
0 Reactions
12.6 K Views
Aurbo99
Posts: 2804
Moderator
Topic starter
(@aurbo99)
Member
Joined: 19 years ago

Cant really make any excuses for my mistakes folks..

headcold + drugs + boredom = my schems..

Thanks for correcting the glaring errors.

I'll redo the schem tomorrow after work..


Reply
Aurbo99
Posts: 2804
Moderator
Topic starter
(@aurbo99)
Member
Joined: 19 years ago
Wombat wrote:Why did you use the transistors when you already have the driver chip as you are only drawing about 20ma from the LED's as they are in series just put them directly on the ULN 2003 chip and have common Annode going to the supply so you dont need the PNP transistors

Ok, drop the Q's all together and connect the ULN2003 as it is minus the Q's to "a-g" segments.

RD0-RD7 do not go to a-g but rather goes through a ULN2803 and is CA instead of CC?

Man, I really spun myself around on this one..

Thanks again for the critiques.. keep them comming! =)


Reply
Posts: 496
(@wombat)
Honorable Member
Joined: 19 years ago

Sorry if I confused you I think I confused myself earlier. You will need to have the PNP transistors as well for the Anode's of the displays. the 8th Display will need both NPN and PNP to drive the Anode.

You will need the driver ULN2003 chip for the cathodes of each segment a-f and DP will need NPN transistor to drive the DP Cathode.

I hope that is less confusing

A ----|>----- K

Wombat


Reply
Aurbo99
Posts: 2804
Moderator
Topic starter
(@aurbo99)
Member
Joined: 19 years ago

Okay..

I'll be semi-afk the next week or so while I prep for my 6 month tour.

Here is my current CDC with what I hope are all the schematic glitches out of the way.. I had to go back to my old dusty books!

I'll mill my pcb once I can get my new pcb mill running.

Take a look, let me know what you think.


Reply
Aurbo99
Posts: 2804
Moderator
Topic starter
(@aurbo99)
Member
Joined: 19 years ago

OK.. I've reached a crossroads on this project.

The circuit looks ok, the bugs seemed to be worked out according to the datasheets.

Where I'm stuck is simple. I cant code the PIC. :confused:

While its very easy to program a PIC.. its something entirely different to create a code that make it sing and dance.

What I need to do now is to have the PIC latch to the 595/2003 chip and light up each segment one at a time and then move on to the next digit.

Any PIC from a 16F627a to the 18F6420 would work in theory.

So I'll throw this out to you guys. Whats needed to advance this project any further at this point is a test code.

Lets narrow it to something many of you have programmed and perhaps coded for.

PIC =16F627A or 16F628

Latch/Driver = http://focus.ti.com/lit/ds/symlink/tpic6c595.pdf

Project = test each segment of each digit..

Once I can get my hands on a test code in BASIC, I can twiddle away at it over the summer to get the timer code running.

and Now the Crossroads..

Change the WHOLE layout.. to a 5x7 led matrix with scrolling message capabilities.. sort of a mini LedTriks.. the parts count will not change much..

The digits already use up 35 led's per Digit.. and a 5x7 will also use 35.. so no real change there.

The specialized 595/2003 combo reverts back to a normal 595 and transistors.

The dual voltages are removed.. everything goes back to 5vdc.

Without any overly specialized code a larger 18F Pic could handle some extra text.
The countdown clock becomes a scrolling countdown clock with added text capablities.

Need some input of this folks..

Steve


Reply
Aurbo99
Posts: 2804
Moderator
Topic starter
(@aurbo99)
Member
Joined: 19 years ago

I found a bit of code that uses a 10F200 and a 595 to run a routine.

I looked at the code, written in C, I think I was able to change it to use a 16F627A by comparing the #defines pins between the 10F200 and the 16F627A.

If one of you coders could take a look and tell me if I'm on the right track with this, it will help move this project a bit closer to completion.

If I'm understanding this correctly, then the following things change on the last schem.

Input buttons RA1-RA5 are removed.. A single button circuit is now on RB7 which will just advance each segment in order.

RC3 - RCK becomes RB6 - DIMM
RC4 - SRCLK becomes RB5 - CLK
RC5 - SER becomes RB4 - DATA

#Include <16F627A.h>

__Config(UNPROTECT&MCLRDIS&WDTDIS);	//Configure Word

#define Fuc_key	RB7
#define DIMM	RB6
#define CLK	RB5
#define DATA	RB4

unsigned char disp_data;
unsigned char key_pressed,last_key_pressed;
unsigned char Value;
unsigned char time;

//The total of cathode
const unsigned char Digital_TAB[]={0xff,0xfc,0x60,0fda,0xf2,0xb6,0xbe,0xe0,0xfe,0xf6,0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};

void change(void);
void LED_data(void);
void LED_display(void);

void delay_2ms(void)
{
	unsigned char i,j,k;
	for(i=0:i<5:i++)
	{
		for(j=0;j<200;j++)
			k--;
		}
	}

	void change(void)
	{
		key_pressed=Fuc_key;
		if(key_pressed==0)
		}
	}
	last_key_pressed=key_pressed;
	}

	void LED_data(void)
	{
		unsigned char i;

		for(i=0;i<19;i++)
		}
			if(i==disp_data)}Value = Digital_TAB[i];}
		}
	}
	
	void LED_display(void)
	{
		unsigned char i;
		unsigned char U;

		U=Value;
		for(i=0;,i<8;i++)
		{
			DATA = U & 0x01;
			CLK = 0;
			U = U>>1;
		}
		CLK =0;
		CLK =1;
	}

	void main(void)
	{
		OSCCAL=0;
		TRIS = 0B11111000;
		OPTION = 0B10011111;

		while(1)
		{
			change();
			LED_data();
			DIMM =1;
			LED_display();
			DIMM = 0		//Active-low Output Enable

			delay_2ms();
		}
	}

Cheers
Steve


Reply
Posts: 6728
(@p-short)
Illustrious Member
Joined: 20 years ago

The code is hard to read because there are so many typos in it, as well as not being very family safe.

--

Phil


Reply
Posts: 6728
(@p-short)
Illustrious Member
Joined: 20 years ago

Here is a version that should be a little bit better. I took the code that you wrote, cut and pasted it into an editor, and tried to fix the syntax and functioning as best I could. There appeared to be stuff missing (especially in the 'change' routine), and lot of minor syntax errors (wrong brackets, colons instead of semi-colons, etc). The changes that I made were based on what I thought would be sensible, not on any knowledge of the exact language that you're using.

There is no guarantee that I caught all of the syntax errors, nor any guarantee that I didn't introduce new ones.

--

Phil


 #Include <16F627A.h>

__Config(UNPROTECT&MCLRDIS&WDTDIS);	//Configure Word

#define FuncKey	RB7
#define DIMM	RB6
#define CLK	RB5
#define DATA	RB4

unsigned char disp_data;
unsigned char key_pressed,last_key_pressed;
unsigned char Value;
unsigned char time;

//The total of cathode
const unsigned char Digital_TAB[]={0xff,0xfc,0x60,0xda,0xf2,0xb6,0xbe,0xe0,0xfe,0xf6,0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01,0x00};

void change(void);
void LED_data(void);
void LED_display(void);

// The actual delay may vary, depending on the actual processor clock speed

void delay_2ms(void)
{
    unsigned char i,j,k;
	
    for(i=0;i<5;i++)
	{
		for(j=0;j<200;j++)
			k--;
	}
}

void change(void)
{
    key_pressed=Funckey;

    // increment disp_data when key is released

    if ((key_pressed==1) && (last_key_pressed==0))
	{
	    disp_data = disp_data + 1;
            if (disp_data == 19)  // make sure that disp_data isn't too big
                {
		    disp_data = 0;
		}
        }
    last_key_pressed=key_pressed;

}

void LED_data(void)
{
    if ((disp_data >= 0) && (disp_data<19))
        {
	    Value = Digital_TAB[disp_data];
	}
}

void LED_display(void)
{
    unsigned char i;
    unsigned char U;

    U=Value;
    for(i=0;i<8;i++)
	{
		CLK = 0;
		DATA = U & 0x01;
		CLK = 1;
		U = U>>1;
	}
}
	
void main(void)
{
    OSCCAL=0;
    TRIS = 0B11111000;
    OPTION = 0B10011111;

    // Some PICS may need additional initialization to turn off the analog
    // features of the processor (such as comparators and ADCs).

    while(1)
	{
	    change();           // handle switch transitions
	    LED_data();         // do output lookup
	    DIMM = 0;
	    LED_display();      // clock data to the 595 (or 595 clone)
	    DIMM = 1;		// Rising Edge Latch Enable

	    delay_2ms();
	}
}

Reply
Aurbo99
Posts: 2804
Moderator
Topic starter
(@aurbo99)
Member
Joined: 19 years ago

Thanks Phil.

No clue about the errors.. I typed it exactly as posted and changed only the #defines..

Thanks for the corrections..

Time to see what it will do if anything.

Cheers
Steve


Reply
Page 3 / 3
Share: