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.

LED moving message .. whats wrong with this code help???

Status
Not open for further replies.

dani

Full Member level 4
Joined
Mar 8, 2004
Messages
231
Helped
6
Reputation
12
Reaction score
4
Trophy points
1,298
Location
UK
Activity points
2,217
hi all,

I have mad 12x8x8 led moving message display following is a code to scroll as welcome message already stored in externall eeprom.


Code:
device 16f877a
xtal 20
ALL_DIGITAL TRUE

dim dbuff[100] as byte  ' current byte buffer to be displayed
DIM ADDR AS WORD
dim caddr as word
DIM I AS BYTE

dim col as word
dim dcol as byte
dim rrow as byte		'row no
DIM ROWDATA[8] AS BYTE
dim full_length as word
symbol clock portC.0
symbol cbit portC.1	
SYMBOL ROW PORTd
output clock
output cbit
OUTPUT ROW	

row=255
DELAYMS 1000
ROWDATA[7]=254
ROWDATA[6]=253
ROWDATA[5]=251
ROWDATA[4]=247
ROWDATA[3]=239
ROWDATA[2]=223
ROWDATA[1]=191
ROWDATA[0]=127
ROW=255							 
addr=0					
full_length=56  ' total length of message(bytes*8)

loop:

	 rrow=0
		while rrow<2
		  col=0
			  while col<95
			  dcol=dbuff[col]
			  call red
			  inc col
			  wend
		  	ROW=rowdata[rrow]
			delayus 700
			inc rrow
			row=255
		wend

		while rrow<5
		  col=0
			  while col<95
			  dcol=dbuff[col]
  			  call green
			  inc col
			  wend
		  	ROW=rowdata[rrow]
			delayus 700
			inc rrow
			row=255  
		wend
	 	while rrow<8
			  col=0
			  while col<95
			  dcol=dbuff[col]
  			  call orange
			  inc col
			  wend
		  	ROW=rowdata[rrow]
			delayus 700
			inc rrow
			row=255  
		wend	
	 
	 
	if addr=full_length then
	addr=0
	else
	inc addr
	call shift_buffer
	endif	
	

goto loop
	 

red:- 'all red on
cbit=0
high clock
low clock
CBIT=GETBIT dcol,rrow
HIGH CLOCK
LOW CLOCK

return

green:- 'all green on
CBIT=GETBIT dcol,rrow
HIGH CLOCK
LOW CLOCK
cbit=0
high clock
low clock

return

Orange:- 'all orange on
CBIT=GETBIT dcol,rrow
HIGH CLOCK
LOW CLOCK
CBIT=GETBIT dcol,rrow
HIGH CLOCK
LOW CLOCK
return

''''''';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;;;;;;;;;;;;;;;;;;;;;;;;


shift_buffer:- ' read one new byte from external eeprom and shift buffer left
					  
dbuff[0]=dbuff[1]:dbuff[1]=dbuff[2]:dbuff[2]=dbuff[3]:dbuff[3]=dbuff[4]
dbuff[4]=dbuff[5]:dbuff[5]=dbuff[6]:dbuff[6]=dbuff[7]:dbuff[7]=dbuff[8]
																  
dbuff[8]=dbuff[9]:dbuff[9]=dbuff[10]:dbuff[10]=dbuff[11]:dbuff[11]=dbuff[12]
dbuff[12]=dbuff[13]:dbuff[13]=dbuff[14]:dbuff[14]=dbuff[15]:dbuff[15]=dbuff[16]
																  
dbuff[16]=dbuff[17]:dbuff[17]=dbuff[18]:dbuff[18]=dbuff[19]:dbuff[19]=dbuff[20]
dbuff[20]=dbuff[21]:dbuff[21]=dbuff[22]:dbuff[22]=dbuff[23]:dbuff[23]=dbuff[24]

dbuff[24]=dbuff[25]:dbuff[25]=dbuff[26]:dbuff[26]=dbuff[27]:dbuff[27]=dbuff[28]
dbuff[28]=dbuff[29]:dbuff[29]=dbuff[30]:dbuff[30]=dbuff[31]:dbuff[31]=dbuff[32]

dbuff[32]=dbuff[33]:dbuff[33]=dbuff[34]:dbuff[34]=dbuff[35]:dbuff[35]=dbuff[36]
dbuff[36]=dbuff[37]:dbuff[37]=dbuff[38]:dbuff[38]=dbuff[39]:dbuff[39]=dbuff[40]

dbuff[40]=dbuff[41]:dbuff[41]=dbuff[42]:dbuff[42]=dbuff[43]:dbuff[43]=dbuff[44]
dbuff[44]=dbuff[45]:dbuff[45]=dbuff[46]:dbuff[46]=dbuff[47]:dbuff[47]=dbuff[48]

dbuff[48]=dbuff[49]:dbuff[49]=dbuff[50]:dbuff[50]=dbuff[51]:dbuff[51]=dbuff[52]
dbuff[52]=dbuff[53]:dbuff[53]=dbuff[54]:dbuff[54]=dbuff[55]:dbuff[55]=dbuff[56]

dbuff[56]=dbuff[57]:dbuff[57]=dbuff[58]:dbuff[58]=dbuff[59]:dbuff[59]=dbuff[60]
dbuff[60]=dbuff[61]:dbuff[61]=dbuff[62]:dbuff[62]=dbuff[63]:dbuff[63]=dbuff[64]

dbuff[64]=dbuff[65]:dbuff[65]=dbuff[66]:dbuff[66]=dbuff[67]:dbuff[67]=dbuff[68]
dbuff[68]=dbuff[69]:dbuff[69]=dbuff[70]:dbuff[70]=dbuff[71]:dbuff[71]=dbuff[72]

dbuff[72]=dbuff[73]:dbuff[73]=dbuff[74]:dbuff[74]=dbuff[75]:dbuff[75]=dbuff[76]
dbuff[76]=dbuff[77]:dbuff[77]=dbuff[78]:dbuff[78]=dbuff[79]:dbuff[79]=dbuff[80]

dbuff[80]=dbuff[81]:dbuff[81]=dbuff[82]:dbuff[82]=dbuff[83]:dbuff[83]=dbuff[84]
dbuff[84]=dbuff[85]:dbuff[85]=dbuff[86]:dbuff[86]=dbuff[87]:dbuff[87]=dbuff[88]

dbuff[88]=dbuff[89]:dbuff[89]=dbuff[90]:dbuff[90]=dbuff[91]:dbuff[91]=dbuff[92]
dbuff[92]=dbuff[93]:dbuff[93]=dbuff[94]:dbuff[94]=dbuff[95]
																  																  

caddr=110+addr+95
hbusin $a1,caddr,[dbuff[95]]
return

on hardware side i have use 74LS164+ULN2003(darlington transistor) to shift and lactch column data and PNP transistor with 2.2K resistance to drive LED matrix.
On time is clear from code is 700us for leds.

Now my problem is FLIKERING

2- display is also not too bright, i have increased on-time that display becomes bright but flikering become more and vice versa.

Any how Flikering is at the moment is main problem for me..
Any one can address this problem the plz reply i m waiting anexousiouly...

Regards
Code:
 

i would take a look at the assembly. my guess is those buffer shifts are being compiled as a
movfw (Address)
decfsz Address
movwf (Address)
... and so on

and it's taking forever to shift everything every time. i would put my array in memory, then move the POINTER, leaving the data where it is. now you can update the pointer much easier like.

incfsz pointer
call resetpointer
goto display

and you're done in 5 clocks instead of 4*95 clocks. but check the assembly, it all depends on how clever your compiler is.
 

hello dani

pls can u give me schematic i will also try to make

plsss

waiting for the reply
 

pls can u give me schematic i will also try to make
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top