Help with a LOW res 30 (or more) gray scale tv driver

LewisDLewisD Posts: 29
edited October 2009 in Propeller 1 Vote Up0Vote Down
I am trying to display a low (18x18 pixel) resolution image.

I acquire the image from an optical mouse sensor adns-2620. ($1.50)

With the low resolution I would think the timing and memory requirement would be easer
but I would like to get 30 or more gray scale.
The ands-2620 outputs 0-63 gray scale.

Having a high level of gray scale will help me focus the image with a lens as well as look KOOL.

I have no experience with hacking a TV driver.

I believe this will require more that a 3 pin DAC ,so 5 or 6 pin are OK


This is my MATRIX display of my finger. tongue.gif
Then pixel data is shifted up the ASCII table by 48 so I can"see" all of the data.
( What? You don't see it? It right there! See?) smilewinkgrin.gif



Co=00 St=41 DY=04 DX=06 SQ=0E MaxP=35 MinP=0D PS=61 SU=0C SL=3A FP=C2 Tick=0A81

JLORTWZ]]]ZWRNIEA=
KMORUY^a_^ZWSOKFB=
LMOSW[noparse][[/noparse]`ba^[noparse][[/noparse]XUQMGB=
LNQVZ^aba_][noparse][[/noparse]WSNHC=
MOSWZ]`bba`]YTOIC>
NOTWZ]acdca^ZUOKE?
ORSVY]aeeca]ZUQMG@
NPSVZ^cddb`^[noparse][[/noparse]WSOHC
NPSW[noparse][[/noparse]_cccb`_\YUOJE
MOSWZ]_bbcba_ZVRNI
LORUWZZaccdb_\YVSO
KNORTW[noparse][[/noparse]^bcb`^][noparse][[/noparse]YWS
JLNQTW[noparse][[/noparse]^aa`_^^\[noparse][[/noparse]WS
JLNQUX[noparse][[/noparse]]^_____\ZWT
ILORTVY[noparse][[/noparse]]^_`_^]ZYW
ILNQRUVY]____][noparse][[/noparse][noparse][[/noparse][noparse][[/noparse]Z
JLMOQSVY\^^_]]]^][noparse][[/noparse]
IJKMOSUWZ[noparse][[/noparse]\]]^__^]*






This is an LED flashlight at ~ 12" .



Co=00 St=41 DY=00 DX=00 SQ=46 MaxP=22 MinP=02 PS=2A SU=31 SL=EB FP=C2 Tick=055D

322333344433332222
223344678987543222
333469=BDEC?;75432
3445:BHKMNMLF>9643
3459CJMOOOOOMJ?953
446?IMNOPOOOONJ=75
459EKNNOPPPOOOMC95
46>JMOOQQQQQQONG:6
47DLOPRRRSRRRQOH;6
59HNQRSSSSSSRRPE:6
59IORSQUTTUSSROA95
58GORSTTTTTSRQJ=75
46>KORSSTSSSQNB:53
346?IMPQQRQQNG<733
3336;DIKLMLJF>7432
333347:?BCB?;74322
333333357776432222
232323222333222222*

Comments

  • 9 Comments sorted by Date Added Votes
  • ericballericball Posts: 770
    edited October 2009 Vote Up0Vote Down
    Is your target a TV or a VGA monitor? For TV you will need at least a 6 bit DAC for >30 levels black to white. Since the Propeller video driver expects a 3 bit DAC for TV your driver will need to use "VGA mode" in order to control all 8 pins. You won't be able to use the color generation, but that isn't a requirement for your project.

    See the templates linked in my sig for a simple video driver which you can modify. I'd recommend starting with a simple 8 level output using normal TV mode and then open it up to the full width.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Composite NTSC sprite driver: Forum
    NTSC & PAL driver templates: ObEx Forum
    OnePinTVText driver: ObEx Forum
    Pay for your free software - let the developers know how much you appreciate their work!

    Links to Propeller stuff I've done (mostly composite video)
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 21,410
    edited October 2009 Vote Up0Vote Down
    The simplest way to do this is to launch a standard TV driver via, say, tv_text. Then launch an assembly cog that syncs to the TV output. This cog can read and display the pixels at the appropriate times by DUTY modulating the MSB of the DAC. That way you don't have to add more pins to get the resolution you need. You will need to add a 220pF cap across the video out connector, though, to filter out the DUTY doody.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • potatoheadpotatohead Posts: 8,980
    edited October 2009 Vote Up0Vote Down
    With that kind of resolution, would dithering be acceptable?

    How big of a screen area will the image be displayed in? Is it pixel for pixel, or 2x2, 4x4, etc...?

    The reason I'm asking, is with a few custom characters, my text driver can do this task nicely --if dithering to simulate greys is acceptable. Done this way, using say 64 column screen, the image would occupy 1/4 of the screen display area, or so.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!
    Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
    Safety Tip: Life is as good as YOU think it is!
    Do not taunt Happy Fun Ball! @opengeekorg ---> Be Excellent To One Another SKYPE = acuity_doug
    Parallax colors simplified: http://forums.parallax.com/showthread.php?123709-Commented-Graphics_Demo.spin<br>
  • LewisDLewisD Posts: 29
    edited October 2009 Vote Up0Vote Down
    Potatohead,

    I think dithering would give me a false sense of the edge of my pixels ,
    making it hard to focus with a lens. but I may give it a try if I cant figure out a TV driver hack.

    Eric,

    I will read through you code and see if I can grasp it. Thanks


    Phil,

    I like "simplest way".

    Could you elaborate on how I would sync the cog with the TV driver.

    The "DUTY modulating the MSB" with a 220pf cap is acting like a one bit DAC , yes?

    Thanks for you help

    Lewis

    Post Edited (LewisD) : 10/16/2009 5:46:49 PM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 21,410
    edited October 2009 Vote Up0Vote Down
    The TV.spin driver asserts all three DAC pins low only during a sync or while displaying super-saturated colors. You can monitor these pins using the following code to detect the leading edge of the sync. The two tests following the waitpeq are there to filter out the chroma from any super-saturated color. You can eliminate this step if you don't use these colors in the TV.spin driver background display. (vidmask is a bitmask that includes the three video DAC pins; zero is a long with a value of 0.)

    sync          [b]waitpne[/b]   zero,vidmask
                  [b]waitpeq[/b]   zero,vidmask
                  [b]test[/b]      vidmask,[b]ina[/b] [b]wz[/b]
            [b]if_nz[/b] [b]jmp[/b]       #sync
                  [b]test[/b]      vidmask,[b]ina[/b] [b]wz[/b]
            [b]if_nz[/b] [b]jmp[/b]       #sync
                          
    sync_ret      [b]ret[/b]
    
    
    


    You will then have to measure the amount of time the pins stay low to determine what kind of sync (vertical, horizontal) it is. Once you've determined that it's a vertical sync, it's just a matter of counting horizontal syncs until you reach the scan line you want to start on and begin generating gray-level output.
    LewisD said...
    The "DUTY modulating the MSB" with a 220pf cap is acting like a one bit DAC , yes?
    Exactly. By taking advantage of this capability in the counters, you free the program for getting the next pixel ready and get a higher (i.e. easier to filter) DUTY rate than you could using software alone.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • Toby SeckshundToby Seckshund Posts: 2,011
    edited October 2009 Vote Up0Vote Down
    A few years ago I was messing with a disembowled optical mouse to see what detail could be got, with HTAs on windows. the lens was a nightmare as it expected there to be only a few mm from object-to-lens-to-sensor and nothing I tried seemed to work. I even tried to widen out the apature on the agilent chip (until it failed). I think it was to be about 30 x 30 cells. I supose an USB interface to a webcam would be a good sensor surface.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point
  • VIRANDVIRAND Posts: 650
    edited October 2009 Vote Up0Vote Down
    This seems like a good job for the VGA mode, as the pixel clock can be very slow, there's no color,
    and more resistors on the VGA connection into the TV video could possibly make a 64 level DAC.
    And there are separate pins on it for SYNC too.

    I'm not sure if modern TVs would turn blue on this but very simple SYNC from VGA mode
    (without those extra pulse details specified in NTSC VSYNC) should work, since it's even possible
    to make a simple audio-oscilloscope video signal effect (rotated 90 degrees) with just a few LM555 timers
    to make simple syncs and wiggle a PONG-like vertical line with incoming audio.
    (That scope effect is so simple I've often added something like it to several realtime audio apps for debugging.)
  • ericballericball Posts: 770
    edited October 2009 Vote Up0Vote Down
    I took PhiPi's DUTY idea an combined it with my NTSC template (then fixed all of my bugs) and created a driver. I've embeded the two sample images, but it should be relatively easy to integrate it with other code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Composite NTSC sprite driver: Forum
    NTSC & PAL driver templates: ObEx Forum
    OnePinTVText driver: ObEx Forum
    Pay for your free software - let the developers know how much you appreciate their work!

    Links to Propeller stuff I've done (mostly composite video)
Sign In or Register to comment.