PDA

View Full Version : Display Format



Tobias
- 21st November 2007, 05:34
I am using the X-1 board with a 16F877A PIC. Learning the LCD and have a question formatting the display of a three digit versus four digit number.

The first row of the LCD is just pretty much the header for the second row. The second row has numeric values. When the numeric values on the second line change from four to three digits, the rest of the second row shifts to the left one click. When this happens, the header row doesn't line up correctly with the second row. If there a way without using a bunch of 'IF' statements, I can format the second row to have each numeric value start in the same column? I wouldn't mind at all 900 looking like 0900. Here is the code I am using:

Lcdout $fe, 1 ' Clear screen
Lcdout "Stage Start End Prog"
If StageState = 0 then
Lcdout $fe, $c0,dec StageNum,"-S"," ",dec DisplaySTIme, " ",Dec DisplayETime
else
Lcdout $fe, $c0,dec StageNum,"-E"," ",dec DisplaySTIme, " ",Dec DisplayETime
endif


I tried using the following to display a leading 0 when a three digit number is used:

Lcdout $fe, 1 ' Clear screen
Lcdout "Stage Start End Prog"
If StageState = 0 then
Lcdout $fe, $c0,dec StageNum,"-S"," ",dec DisplaySTIme+0000, " ",Dec DisplayETime+0000
else
Lcdout $fe, $c0,dec StageNum,"-E"," ",dec DisplaySTIme+0000, " ",Dec DisplayETime+000
endif

That didn't work out. Any suggestions?

Also, I would like to underline 'Start' or 'End' in the header column at times. What is the command for underline?

Thanks
Toby

Archangel
- 21st November 2007, 08:41
Lcdout $fe, <font color=red>$c0</font color>,dec StageNum,"-S"," ",dec DisplaySTIme+0000, " ",Dec

Thanks
Toby

Hello Tobias,
The code in red is where you tell the LCD where to start, and can be decimal ($c0 = 192) or hex as you have it. You will find line 3 is a continuation of line 1 and line 4 is line 2 continued.
Position 1 for each line is as follows: line 1 = 128, line 2 = 192, line 3 = 148 and line 4 = 212, so add 1 to each of the above to move them over 1 space, or add spaces to your string.
HTH
JS