Showing Space Character - Code Problem !!

Status
Not open for further replies.

Suraj143

Active Member
I'm doing a 5X7 project.I can show any character except the space character.

My code detects the binary 0x00 & if it founds then it will exit from the Load_Char routine.

I don't know how to show the space character ??

Code:
Load_Char	movlw	30h
		movwf	FSR

Load_Char_Loop	movf	Pointer,W		; character to be show
		movwf	offsetL
		clrf	offsetH	
		call	ASCII_Table
		movwf	INDF
		incf	FSR,F
		incf	Pointer,F
		movf	INDF,W
		btfss	STATUS,Z
		goto	Load_Char_Loop
		return


ASCII_Table  	movlw	High(Table)		; perform read from long table
		addwf	offsetH,W
		movwf	PCLATH
		movlw	Low(Table)
		addwf	offsetL
		btfsc   STATUS,C
		incf	PCLATH,F
		movwf   PCL

Table		retlw	b'11111100'		; Char_"A" = 0 offset
		retlw	b'11111110'
		retlw	b'00010010'
		retlw	b'00010010'
		retlw	b'11111110'
		retlw	b'11111100'
		retlw	b'00000000'
		;
		retlw	b'11111110'		; Char_"B" = 7 offset
		retlw	b'11111110'
		retlw	b'10010010'
		retlw	b'10010010'
		retlw	b'11111110'
		retlw	b'01101100'
		retlw	b'00000000'
 
Drop the silly zero's at the end of each character, they aren't needed as they do nothing - you already know exactly how long each character is, so no need for a termination byte.

Check my tutorials for deatils of how I did 8x8 text and scrolling.
 
Brother its wrong.

I have variable width of characters.I read your article but your characters are same width.So you don't need a termination character.But my characters are not same width that's why I need a termination character.
 
Brother its wrong.

I have variable width of characters.I read your article but your characters are same width.So you don't need a termination character.But my characters are not same width that's why I need a termination character.

Make your characters the same width - why would you not want to?.

You can't have a termination character because you require all 256 possible values - unless you're only using 7 bits of each byte, then you could use the unused bit for a termination bit.
 
If you have a same width characters the display isn't nice.All sign products uses variable width characters.So I want to make variable width characters.
 
Vertical side (Row Side) = 7 bits
Horizontal side column side (Width) = variable.

I can use an unused bit but in future I planned to extend the vertical side to 8 or 16 so I cannot use an unused bit.
 
Vertical side (Row Side) = 7 bits
Horizontal side column side (Width) = variable.

I can use an unused bit but in future I planned to extend the vertical side to 8 or 16 so I cannot use an unused bit.

In which case you are pretty stuffed - unless you use multiple bytes for each vertical line. So to use 8 bits would need two bytes, to use 16 would need three. Seven bits would only require a single byte, with the eighth bit as a terminator, or 15 bits would only need two.

You could always used fixed width characters, and blank off the extra blank lines at the end when you display them - space would be an easily spotted exception because it would have a blank line at the front.
 
Consider using a "size" byte at the beginning of each character pattern instead of a "null" terminator at the end of each character pattern for a proportional-pitch font.

Regards, Mike
 
Last edited:
Consider using a "size" byte at the beginning of each character pattern instead of a "null" terminator at the end of each character pattern for a proportional-pitch font.

Good thought Mike, Pascal style string rather than C style.
 
Mike that's a very nice suggestion that's the one I'm going to use. Thanks for your excellent idea.

Mike & Nigel I have a problem.

Now you two know I have a variable width character table. The problem is finding the offset value to an ASCII character.

Nigel doesn't have a problem in his code because he has a fixed width character so he just multiply by 8 & finding the offset value.

I have two solutions to find out the offset.

* Write another offset table to point the ASCII character set.

* Write the entire Table to 8x8 byte format. Still the first byte is the size byte (Mikes way).When showing the character in the display call table & decrement the size byte value & if it is zero show nothing for the remaining bytes.In this way I can multiply by 8 & find the offset value like Nigel do.

What’s the professional way to do this guys?
 
Last edited:
Either method would be fine, but a more 'professional' way would be to count through the table to find the character you want - each character will have a first byte giving it's length, so you can use that to jump to the next character, keep doing that until you reach the one you want.

It's similar to what BASIC interpreters used to do, with each line having a pointer to the start of the next one.
 
Hi Nigel the idea is good but the problem is..

If you have 150 characters (with additional symbols) you have to call the width byte 149 times that takes hell of a lot of time to load a character.
 
Is there a value for a character that you have not used?
When the program detects this special value, it outputs zero's.
I use the 7th bit for my 5x7 Display as no character used it.
 
Hi Nigel the idea is good but the problem is..

If you have 150 characters (with additional symbols) you have to call the width byte 149 times that takes hell of a lot of time to load a character.

PIC's run incredibly quickly, sensibly written routines should be plenty fast enough.

If you want it faster, then simply have an index to the character data - read the index, which give the address of the character, then fetch that character.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…