View Full Version : B & W output

09-04-2007, 10:15 PM
Hi, I am currently outputting text only to a small LCD using the TV object. I do not need colour and have tried setting VCFG and VSCL but the timing is out. So does anyone know what would be suitable values for VSCL. I am OK with VCFG, have cleared the CMode bit, also is there something else I am missing. Any help would be appreciated.

09-04-2007, 10:48 PM
(a) As long as possible you should stay with the configuration of TV in its interface and not override it by modified code.
However this is o.k. when you know what you are doing.
(b) You have to tell us something about your monitor.
(c) One can generally calculate the pixelclock from numbr of lines and pixels per line.
What means: "I don't need color?" So don't use it, but there is not much penalty. The picture can become sharper without the chroma signal. Is the monitor able to display color? So try it first with color.

When you have the fourth resistor (audio/chroma) connected to the DAC, unsetting global chroma might not be a very good idea.
All the "colors" you need have to be grayscale (there are around 6 gray colors), the chroma bit in all colors mast be reset.

(d) What does it look like when you use an unchanged TV.SPIN?
Try also to set PAL.

09-04-2007, 11:07 PM
Hi deSilva, thanks for the quick reply. I am using a Sony PS One LCD, its 5 inches diagonally and 320 by 240 pixels. I am currently using the TV driver as is and would like to free up memory for a back buffer, so intend to use 1 bit per pixel instead of 2 for colour, halving my currently allocated memory. The manual says I need to set a pixel clock and frame clock, where the frame clock is x 32 the pixel clock, and was wondering what suitable values these would be and what else, if anything needs to be done. I have tried some clock settings but do not seem to be able to get a stable image, and have been modifying the code in one section only, line 295 in the IDE where the video configuration is set using t1 as a temp variable and directly below that for VSCL where hx is loaded and used to 'compute horizontal metrics'.

09-05-2007, 02:47 AM
O.k., I understand that TV works fine and you want to change it to "2-color-mode" http://forums.parallax.com/images/smilies/smile.gif

I don't know if anyone did this before, it's not difficult, but tricky...

(1) Clearing just the CMODE flag seems risky, as you do not know what sync or porch operation might trickily rely on 4-color mode....
So we change it for the visible stuff only:

before ":tile" near line 93 add
ANDN vcfg, fourcolorbitmask

after "djnz x,#:tile 'another tile?" add
OR vcfg,fourcolorbitmask

obviously define "fourcolorbitmask as
LONG |< 28

As we now need only half of the bytes in a line we devide the columns by 2
Note that we still configure 16 bit tiles; it is too risky to touch the center routines....
This is around line 102, setting the loop counter
mov x,_ht 'set horizontal tiles
SHR x, #1 ' note _ht must be even

(2) Now for VSCL (your question): as we now output 32 bits we have to double frame clocks
this is around line 316:

mov hx,_hx 'compute horizontal metrics
shl hx, #8
or hx,_hx
shl hx, #4

mov hc2x,_ht
shl hc2x,#1
mov hx, _hx 'compute horizontal metrics
shl hx, #7
or hx, _hx
shl hx, #5

mov hc2x,_ht
Important! Delete this line: shl hc2x, #1
as the lines are now only half as long

Note: I did not touch the COLOR vector. You now only need half the vector as the number of EFFECTIVE tiles (not the "configured") is reduced.... This is not very clean... I do not see immediately whether only the first half of the COLOR vector is used or the even entries only... This is something for YOU to fix http://forums.parallax.com/images/smilies/smile.gif

Post Edited (deSilva) : 9/4/2007 8:02:43 PM GMT

09-05-2007, 04:27 AM
Wow, i'll give this a try tomorrow and post back the results. Thankyou for your time.

09-05-2007, 07:11 AM
I have modified the Parallax drivers to create a 2 color version. The modified b/w version is used in the Hydra game SpaceWar! posted here: http://forums.parallax.com/showthread.php?p=647476, and in the HDMF demos posted here: http://forums.parallax.com/showthread.php?p=652719.

The version used in those programs always draws in "white" regardless of the current "color" setting. I have an updated version which I am using for another project which supports drawing in both white and black (thus allowing you to "erase" regions of the screen".

In the interest of saving memory, my version does not support lower case text, but that is trivial to add back in.

I have not yet added support for wide pens (i.e. drawing thick lines) or for block fill (the block fill code needs to be rewritten for the memory layout of a 2 bit image, and I have not yet bothered because I haven't needed it).

09-05-2007, 02:02 PM
Hi deSilva, have tried your suggestions and with slight modification I get a stable image. I have cleared the CMode bit in VCFG after hsync is called and after backporch is done and all is ok, line 102. CMode bit is reset as you suggested after pixel data has been written, and VSCL has been modified as you suggested. Have some scaling issues but I think in time I will be able to sort those out, thanks very much for help. Hi epmoyer, have given your driver a quick test and it also works for me, though gives diferent results on screen so I will have to study the changes and hopefully I will be able to sort out scaling. Once again, thanks very much for the replies.

09-05-2007, 11:02 PM
deSilva said...
When you have the fourth resistor (audio/chroma) connected to the DAC, unsetting global chroma might not be a very good idea.

A common misconception. The 4th resistor is only used for RF audio.

09-06-2007, 12:06 AM
a physical solution would be to make the TV interface substituting potentiometers... then adjust the circuit until you get a nice crisp black and white.

Works for me:)


09-06-2007, 12:43 AM
ericball said...
A common misconception. The 4th resistor is only used for RF audio.

The forth resistor is used for anything coming out of the fourth pin http://forums.parallax.com/images/smilies/smile.gif
In baseband mode this is the chroma signal when the option "separate chroma" is selected. This is extremely useful and necessary for S-Video. It would have been a good idea on some boards to allow its exclusion from tha DAC by a jumper. Some boards do this, or even sport an S-Video plug.

The problem when setting "separate chroma" is that the chroma signal will sneek in by this path in in unorderly way giving you subtimes sub-optimal color quality, depending on the tolerances of your monitor

Post Edited (deSilva) : 9/5/2007 5:48:31 PM GMT