Shop OBEX P1 Docs P2 Docs Learn Events
noob: VGA ARGH!!! — Parallax Forums

noob: VGA ARGH!!!

cbmeekscbmeeks Posts: 634
edited 2005-06-16 03:39 in General Discussion
Ok, maybe I have bitten off more than I can chew. But, I HAVE gotten a B/W NTSC video circuit to work before on a PIC.

Anyway, I am trying my luck at generating a VGA display using an SX28 and SX/B.

Here is my code:

' -------------------------------------------------------------------------
' Program Description
' -------------------------------------------------------------------------
'
' -------------------------------------------------------------------------
' Layout
' -------------------------------------------------------------------------
'    
'    RA.0    =    Red0
'    RA.1    =    Red1
'
'    RC.6    =    HSync
'    RC.7    =    VSync

' -------------------------------------------------------------------------
' Device Settings
' -------------------------------------------------------------------------

DEVICE          SX28, OSCHS2, TURBO, STACKX, OPTIONX
FREQ            50_000_000

' -------------------------------------------------------------------------
' Variables
' -------------------------------------------------------------------------
VSync        var    rc.7
HSync        var    rc.6

' -------------------------------------------------------------------------
INTERRUPT
' -------------------------------------------------------------------------
'Vertical Timing

'Horizonal Dots         640     640     640
'Vertical Scan Lines    350     400     480
'Vert. Sync Polarity    NEG     POS     NEG      
'Vertical Frequency     70Hz    70Hz    60Hz
'O (ms)                 14.27   14.27   16.68     Total frame time
'P (ms)                 0.06    0.06    0.06      Sync length
'Q (ms)                 1.88    1.08    1.02      Back porch
'R (ms)                 11.13   12.72   15.25     Active video time
'S (ms)                 1.2     0.41    0.35      Front porch

'         ______________________          ________
'________|        VIDEO         |________|  VIDEO (next frame)
'    |-Q-|----------R-----------|-S-|
'__   ______________________________   ___________
'  |_|                              |_|
'  |P|
'  |---------------O----------------|
    
    low VSync        'P
    pauseus 60

    low VSync        'Q
    pauseus 1020

    high VSync        'R
    pauseus 15250

    low VSync        'S
    pauseus 350

    high VSync

RETURNINT 


' =========================================================================
  PROGRAM Start
' =========================================================================
Start:
    output ra.0
    output ra.1

    output rc.6
    output rc.7

    OPTION = $88                                  ' interrupt, no prescaler

Main:

'Horizonal Dots         640     640     640        
'Vertical Scan Lines    350     400     480
'Horiz. Sync Polarity   POS     NEG     NEG
'A (us)                 31.77   31.77   31.77     Scanline time
'B (us)                 3.77    3.77    3.77      Sync pulse lenght 
'C (us)                 1.89    1.89    1.89      Back porch
'D (us)                 25.17   25.17   25.17     Active video time
'E (us)                 0.94    0.94    0.94      Front porch

'         ______________________          ________
'________|        VIDEO         |________| VIDEO (next line)
'    |-C-|----------D-----------|-E-|
'__   ______________________________   ___________
'  |_|                              |_|
'  |B|
'  |---------------A----------------|

    low HSync    'B
    pauseus 4


    low HSync    'C
    pauseus 2

    
    high HSync    'D
    pauseus 25


    low HSync    'E
    pauseus 1



GOTO Main




Now, my monitor blinks orange when there is NO signal.

Using that code, the screen actually tries to lock on and I can "hear" it change. Then, the light stays a solid orange.
No green light which I am assuming means my timings are off.

Now, if I REMOVE the OPTION directive, the screen doesn't do anything but the light blinks from orange and green???

In this code, I am not trying to display anything...just simply trying to get a lock. The monitor is an old Samsung SyncMaster3 which I know works.

Any clues would help...

THANKS!

cbmeeks

Comments

  • BeanBean Posts: 8,129
    edited 2005-06-16 01:47
    I'm working on the same thing. Great minds think alike...
    Why are your changing HSync in the main code and VSync in the interrupt ?
    I haven't actually connect to the montor yet, I'm trying to find a cheap one incase I destroy it [noparse];)[/noparse]
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    Product web site: www.sxvm.com

    "If you keep doing what you always did, you'll keep getting what you always got."
    ·
  • cbmeekscbmeeks Posts: 634
    edited 2005-06-16 03:00
    Bean (Hitt Consulting) said...
    I'm working on the same thing. Great minds think alike...
    Why are your changing HSync in the main code and VSync in the interrupt ?
    I haven't actually connect to the montor yet, I'm trying to find a cheap one incase I destroy it [noparse];)[/noparse]
    Bean.

    lol...yeah, I think we are the only two...hehe

    Why? I don't know why. All I can find is timing information but I can seem to find anything that says when to start the timing, etc.

    So, I am experimenting I guess.

    I thought the VSync and HSync had to happen at the same time....hmmm

    Back to the drawing board.

    cbmeeks
  • BeanBean Posts: 8,129
    edited 2005-06-16 03:24
    They do, but you want to set them both in the interrupt routine, otherwise they are not syncronized.
    BTW: I just got my video overlay to work, finally...
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    Product web site: www.sxvm.com

    "If you keep doing what you always did, you'll keep getting what you always got."
    ·
  • cbmeekscbmeeks Posts: 634
    edited 2005-06-16 03:39
    oh, so I need to start them both in the interrupt? that is what is confusing me.

    congrats on your video overlay
Sign In or Register to comment.