Hi Russ

i am trying to implement a 6 digit display
the problem is my variable Max_Disp which holds the data that is displayed
can only hold up to 5 digits so 12345 displays ok but when its 123456
this is grater than a word variable can hold so i need so help in how to do this i am following all the advice given but still lost

Regards
ISAAC
Quote Originally Posted by RussMartin View Post
isaac, depending on what you need, you may also be able to manipulate your data in software and massage it into individual digits for serial output. What is the nature of the information you want to read? And from what is that information derived?
Code:
	
Again:		
	Max_Disp=12345
	Gosub Display			' Display the Value of Counter
	Pause 150			' Delay, so we can see whats happening
  goto again


Display:
	Digit=0						' Start at Digit 0 of Max_Disp Variable
	For Position=6 to 1 step -1			' Start at Farthest Right of Display 		
	Register=Position				' Place Position into Register
	R_Val=Max_Disp Dig Digit			' Extract the individual numbers from Max_Disp			
	If Max_Disp<10 and Position=3 then R_Val=15	' Zero Suppression for the second digit
	If Max_Disp<100 and Position=2 then R_Val=15	' Zero Suppression for the Third digit
	If Max_Disp<1000 and Position=1 then R_Val=15	' Zero Suppression for the Forth digit
	If Max_Disp<10000 and Position=0 then R_Val=15	' Zero Suppression for the Fifth digit
	If Digit=Max_Dp then R_Val.7=1			' Place the decimal point, held in Max_DP
	Gosub Transfer					' Transfer the 16-bit Word to the MAX7219
	If Digit>=5 then Digit=0			' We only need the first 6 digits
	Digit=Digit+1					' Point to next Digit within Max_Disp
	Next Position					' Close the Loop
	Return						' Exit from subroutine

' Send a 16-bit word to the MAX7219 
Transfer:
  	Shiftout Dta,Clk,msbfirst,[Register,R_Val] ' Shift Out the Register first, then the data
	High Load				' The data is now acted upon
@	Nop
@	Nop					' A small delay to ensure correct clocking times
	Low Load				' Disable the MAX7219 
	Return					' Exit from Subroutine