Shop OBEX P1 Docs P2 Docs Learn Events
Getting started with Propeller video output... — Parallax Forums

Getting started with Propeller video output...

iam7805iam7805 Posts: 14
edited 2006-07-01 18:35 in Propeller 1
Hi guys,

I'm getting started with using the Propeller chip. Luckily, the Spin language is based on BASIC which is great, because I already know BASIC quite well.smilewinkgrin.gif

It's confusing me how to output video to a TV though. I read through the manuals and the comments in the TV.spin and Graphics.spin files, and was still confused on how to do this.

So, could anybody give me a straight-forward guide on how to output graphics and text? This Propeller seems very promising for my project, now to learn how to use it. tongue.gif

Thanks,
iam7805

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-07-01 03:45
    Start with the demo programs that include some kind of tv output (like tv_text_demo). Once you have those working unchanged, you can modify them to suit your purposes. If you have the Demo Board, you have all the hardware you need. If you have a PropStick or just the Propellor chip, you'll need to attach the 3 or 4 resistors needed for the D/A conversion. Look at the Demo Board schematic for the values and how they're connected. The demo programs mostly assume you want to output video rather than a tv broadcast signal. Doing video is simpler since you don't have to change anything.
  • iam7805iam7805 Posts: 14
    edited 2006-07-01 18:17
    Ok, would this work the way I want (display Hello World on TV)?

    ' Hello World program 
    ' Written by iam7805
     
    ' Required files: 
    ' hello world.spin (this file) 
    ' tv_text.spin 
    ' tv.spin 
    
    VAR 
       byte loop 
    OBJ 
       textdisplay : "tv_text" 
    PUB start 
       textdisplay.start (12)    ' start display, base pin 12 
    PUB message 
       textdisplay.out($48)      ' H 
       textdisplay.out($65)      ' e 
       textdisplay.out($6C)      ' l 
       textdisplay.out($6C)      ' l 
       textdisplay.out($6F)      ' o 
       textdisplay.out($20)      ' <space> 
       textdisplay.out($57)      ' W 
       textdisplay.out($6f)      ' o 
       textdisplay.out($72)      ' r 
       textdisplay.out($6C)      ' l 
       textdisplay.out($64)      ' d 
    PUB stop 
       loop := 0 
    REPEAT 
       UNTIL loop := 1           ' Spin doesn't have Do...Loop
    

    (The reason i'm asking is because I don't actually have a Propeller yet)
  • Mike GreenMike Green Posts: 23,101
    edited 2006-07-01 18:33
    1) PUB and PRI mark the beginning of a subroutine. They're not labels in the way you might expect from Stamp Basic.
    2) There are some shortcuts:

    CON
    SetX = 10
    SetY = 11
    VAR
    long count
    OBJ
    textdisplay : "tv_text"
    PUB Main
    textdisplay.start(12)
    textdisplay.str(string("Hello World"))
    repeat count from 1 to 1000
    waitcnt(80_000_000 + cnt) ' waits one second
    textdisplay.str(string(SetX,2,SetY,2))
    textdisplay.dec(count)

    Note that this will put out a video signal, not a broadcast signal (on some tv channel). To do this, you have
    to modify the tv_text object. Attached is a modified version of tv_text. Since the pins for the tv D/A have
    to be in groups of 4 (as far as the program is concerned), I use the lower 2 bits of the pin number to specify
    the tv channel to be used. If the bits are zero, color, progressive scan video is produced. If the bits are 1 through 3, TV channels
    2 through 4 are used. For TV, I've disabled color and used interlaced mode for a better display. I recommend
    using channel 3. Because of how the RF is produced, there's more static if channels 2 or 4 are used.
  • Mike GreenMike Green Posts: 23,101
    edited 2006-07-01 18:35
    Oops ... I forgot about the stripping of indenting in the standard message box. Please correct. Everything except the CON, VAR, OBJ, and PUB should be indented once and the stuff after the repeat statement should be indented twice.
Sign In or Register to comment.