Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Experts ple solve my led display problem (.at89s52 with keil C source code + proteus)

Status
Not open for further replies.

n2roy

Newbie level 3
Newbie level 3
Joined
May 10, 2013
Messages
4
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,309
Experts plz solve my led display problem (.at89s52 with keil C source code + proteus)

I was trying to builds a 16 X 72 led Display, but im stuck on programing. In Proteus simulation led message going smoothly but In real Mcu project its not which i expect, Led message is running but Shaken, may be its for low refresh rate. How to get more Refresh rate...

here is source code:
=====================
Code:
	   /* The current program led matrix 16x64

#include "regx52.h"
#include "font_code.h"
#define scan_led P2
/////////////////////////////
//////Initial setup//////
#define so_led 8	//     multiple of 8
#define so_hang 16	//   the height of the font
#define multi so_hang+1		 //
#define cot_font 11	//   width font
#define en_run 1	
////////////////////////////

typedef unsigned char uchar;
typedef unsigned int uint;
sbit rck=P3^2;
sbit srck=P3^0;
sbit ser_in=P3^1;
sbit en_hc154=P3^3;

bit run=0,en=en_run;
idata uchar display_buffer[so_hang][so_led];
idata uchar shift_buffer[so_hang];
uchar row_buffer[16]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
uchar row_led[16]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
uchar tocdoh=0xf6,tocdol=0x00;
uchar kitu_code=0;
char row=multi;
void shift_dataled();
void test_led();
void clear_buffer();
void run_string();
void copy_datacode();
void scan_dataled_code();
void init_interrupt();

////////////////////////////////
/////// Timer 0 ////////////
void isr_timer0() interrupt 1 using 1
{
	TH0=tocdoh,TL0=tocdol; 
	if(--row==-1) row=multi-1;
	shift_dataled();
	if(row==so_hang) run=1;
}
////////////////////////////////
/////////The main program/////
void main()
{
	uchar w;
	init_interrupt();
	test_led();
	clear_buffer();
	if(en==0) scan_dataled_code();

	while(1) 
		{			
			if((run==1)&(en==1)){
				IE&=0xfd;
				run_string(),run=0;
				if(++w==8) copy_datacode(),w=0;
				row=so_hang;
				IE|=0x02;
			}

		}

}
////////////////////////////////
//////// checking for problems led ////////////
void test_led()
{
	uchar i,j;
	uint t_delay=10000;
	for(i=0;i<so_hang;i++)
		for(j=0;j<so_led;j++)
			display_buffer[i][j]=0xff;
	while(--t_delay); 
}
void clear_buffer()
{
	uchar i,j;
	for(i=0;i<so_hang;i++)
		for(j=0;j<so_led;j++)
			display_buffer[i][j]=0;	
}

////////////////////////////////
///////translate data and scan LEDs////
void shift_dataled()
{
	char i,j;
	
	srck=0;
	rck=0;
	if(row<so_hang){
		for(i=0;i<so_led;i++)
			for(j=0;j<8;j++){
				ser_in=display_buffer[row][i]&row_buffer[7-j];
				srck=1;
				srck=0;
			}
		en_hc154=1;
		rck=1;
		rck=0;
		scan_led=row_led[row];
		en_hc154=0;
	}
	
}
void copy_datacode()
{
	uchar i;
	static uchar j;
	for(i=0;i<so_hang;i++)
		shift_buffer[i]=Bmp002[Bmp002[2]*i+3+j];
	if(++j==Bmp002[2]) j=0;
}
////////////////////////////////

void run_string()
{
	uchar i,j;
	for(i=0;i<so_hang;i++)
		{
			for(j=0;j<so_led;j++)
				{
					display_buffer[i][j]<<=1;
					if(j!=(so_led-1)) display_buffer[i][j]|=((display_buffer[i][j+1]&0x80)>>7);
					else display_buffer[i][j]|=((shift_buffer[i]&0x80)>>7);
				}
			shift_buffer[i]<<=1;
		}
}
void scan_dataled_code()
{
	uchar i,j;
	for(i=0;i<so_hang;i++){
		for(j=0;j<so_led;j++){
			display_buffer[i][j]=Bmp002[Bmp002[2]*i + 3+j];
		}
	}
}
////////////////////////////////

void init_interrupt()
{
	TMOD=0x02; //timer0 mode 1 16b
	TH0=0xF8;
	TL0=0x30;
	TR0=1;
	TR1=1;
	IE=0x82;	//timer0 interrupt enable
}

- - - Updated - - -

here is schematic of that project...

Untitled.jpg
 
Last edited by a moderator:

Re: Experts plz solve my led display problem (.at89s52 with keil C source code + prot

You want somebody to draw the Proteus Schematic and then Compile the code and test it. Can't you zip and post your Keil project files and Proteus file?
 
Re: Experts plz solve my led display problem (.at89s52 with keil C source code + prot

Proteous ................

I would say its a great tool to simulate a code and its also great tool to make you fool !!!!!!

Please check your code on a real hardware module by module. Break down your codes and start it step by step. As there is no HW schamatic so its hard to detect the problem.

Regards

Engr. Amir Rashid Chishti
Design Engineer (electronics)
amir.rashid7@gmail.com
 
you chang code.here

void init_interrupt()
{
TMOD=0x02; //timer0 mode 1 16b
TH0=0xF8;
TL0=0x30;
TR0=1;
TR1=1;
T2CON=0x00;
T2MOD=0x00;
IE=0x82; //timer0 interrupt enable
}
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top