The Godfather talking
You may crack software. How about me?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 09, 2016, 02:31:02 14:31


Login with username, password and session length


Pages: [1]
Print
Author Topic: PIC interface with an old arcade monitor  (Read 1864 times)
0 Members and 1 Guest are viewing this topic.
Kova
Junior Member
**
Offline Offline

Posts: 68

Thank You
-Given: 166
-Receive: 24



« on: May 19, 2012, 04:15:07 16:15 »

Hi all,

I have an old arcade games with a CGA (Hsync 15kHz Vsync 60Hz) and EGA (Hsync 25kHz Vsync 60Hz) monitors and I want to interface with a PIC.

The arcade monitors, than a VGA monitors (Hsync 31kHz Vsync 60Hz), work with a different Hsync freq.
The video signals present on the monitor are: R,G,B, Sync, Ground (here you will find the complete pinout of jamma standard: http://www.coin.demon.co.uk/jamma.htm)

So, this is (a part of) what I would like to do:
I downloaded from here: http://www.pic24.ru/doku.php/en/osa/articles/vga_game the source code, but it žs written to work with a VGA monitor.
In the vga_game_main.c file there is this code:
PR2 = (char)(1.2 * 318/4 - 1); // 31.8 us
This timer is used to generate the 31kHz sync.
In your opinion If I put simply PR2 = (char) ((1.2 * 318/4 - 1)*2) to generate a 15kHz freq...could work?

In the arcade monitor interface there aren't Hsync and Vsync signals but only the Sync signal, so both H/Vsync signals (output from the pic) will be connected together in the same point (P point on the jamma connector).
This connection (H and Vsync connected together) is also used when it connects a PC to an arcade monitor (in this case the Hsync video frequency is forced to work at 15kHz by a dedicated software).

Thanks a lot for any advice.
Bye Smiley
Logged
zab
Active Member
***
Offline Offline

Posts: 132

Thank You
-Given: 24
-Receive: 54


« Reply #1 on: May 19, 2012, 04:56:11 16:56 »

Can not get access to the referred source code.  no doubt PR2 is used to get requisite frequency.but it also depend on main crystal frequency as well.
use this site for reference
http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html
« Last Edit: May 19, 2012, 05:01:44 17:01 by zab » Logged
Kova
Junior Member
**
Offline Offline

Posts: 68

Thank You
-Given: 166
-Receive: 24



« Reply #2 on: May 19, 2012, 07:01:49 19:01 »

Can not get access to the referred source code.  no doubt PR2 is used to get requisite frequency.but it also depend on main crystal frequency as well.
use this site for reference
http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html


Thank you for your response Smiley
Strange that you get access to the source code, but the part of interest is:

Code:
    //------------------------------------------------------------------------------
    // Timers
    //------------------------------------------------------------------------------
   
    T2CON = 0x1C;   // post = 4;
    T1CON = 1;
    PR2 = (char)(1.2 * 318/4 - 1);      // 31.8 us

    CCP1CON = 0x0C;         // PWM mode

And I understand that what I wrote before it is completely wrong. 
Logged
Kova
Junior Member
**
Offline Offline

Posts: 68

Thank You
-Given: 166
-Receive: 24



« Reply #3 on: May 20, 2012, 09:26:58 09:26 »

Hi again,

I would extend my thread with another question that I hope somebody can answer :-)
I drawn this scheme (I know that it is not make enough sense Cheesy):
http://i46.tinypic.com/2zg7l7l.png

The PIC2 has to control the 2way switches to decide which video signals have to connected to monitor. It has also used to switch ON/OFF the PIC1 (that generate the video signals at 15kHz)
Which type of switches I have to use to switch these video signals?
Is there some impedence issues?
To switch on/off the PIC1, can I use a relay on the VCC line?

Thanks a lot Smiley
Best regards Smiley
« Last Edit: May 20, 2012, 11:15:12 11:15 by Kova » Logged
solutions
Hero Member
*****
Offline Offline

Posts: 1446

Thank You
-Given: 591
-Receive: 851



« Reply #4 on: May 20, 2012, 10:25:41 10:25 »

You don't need switches at all. Just configure the ports as tristate or even as inputs and tie the PIC lines together. Enable one or the other as your active outputs.

I guess I missed why you are using two PICs in the first place when all I'd think you need to do is run a different chunk of firmware.
Logged
Kova
Junior Member
**
Offline Offline

Posts: 68

Thank You
-Given: 166
-Receive: 24



« Reply #5 on: May 20, 2012, 11:00:48 11:00 »

You don't need switches at all. Just configure the ports as tristate or even as inputs and tie the PIC lines together. Enable one or the other as your active outputs.

I guess I missed why you are using two PICs in the first place when all I'd think you need to do is run a different chunk of firmware.

Hi,
thanks for the response.
The scenario is the follow:
a) The PC VGA works with the Xsync at 31kHz freq (it is not accepted by the arcade monitor that it works with a Sync of 15kHz). This frequency is possible to modify via software (for example with soft15kHz or powerstrip programs) only when Windows has been started.
b) During the PC is booting (so the VGA works at 31kHz) the PIC2 has to check the freq and if > 16kHz (windows is booting), it has to switch the video signals from the PC VGA to PIC1 where the video game works with the sync at 15kHz.
It is a sort of protection to avoid to damage the arcade monitor during the PC boot (and in this phase, I want to play with the PIC1 video game Cheesy)
c) When windows is started (than the soft15kHz tool has forced the vga to work at 15kHz), the PIC2 has to switch the video signals from PIC1 to PC VGA.

I want to use two PICs because I want a dedicated PIC to display the video game (see my first post) and a second one to check the Sync freq. and to switch from one video source to another (and maybe other things that now I'm thinking Cheesy)

Thank you Smiley

P.S.
I edited the scheme, I hope that now it is a little bit clear Smiley
« Last Edit: May 20, 2012, 11:29:21 11:29 by Kova » Logged
gan_canny
Junior Member
**
 Warned
Offline Offline

Posts: 85

Thank You
-Given: 98
-Receive: 25


« Reply #6 on: May 20, 2012, 04:47:54 16:47 »

Looks like the PIC code uses the PWM feature that sets both the duty cycle for a square wave and it's frequency
Google pwm calculator to get the full spread sheet.

FOSC   10000000      
POST?   1      
PRE   1   4   16
PR   PWM Freq   PWM Freq   PWM Freq
0   #DIV/0!   #DIV/0!   #DIV/0!
1   2500000   625000   156250
2   1250000   312500   78125
3   833333   208333   52083
4   625000   156250   39063
5   500000   125000   31250
6   416667   104167   26042
7   357143   89286   22321
8   312500   78125   19531
9   277778   69444   17361
10   250000   62500   15625
11   227273   56818   14205
12   208333   52083   13021
13   192308   48077   12019
14   178571   44643   11161
15   166667   41667   10417
16   156250   39063   9766
17   147059   36765   9191
18   138889   34722   8681
Logged
solutions
Hero Member
*****
Offline Offline

Posts: 1446

Thank You
-Given: 591
-Receive: 851



« Reply #7 on: May 21, 2012, 03:33:11 03:33 »

Google?

PWM calculator for PIC is in this thread.

http://www.sonsivri.to/forum/index.php?topic=7981.0

You are new - please don't make 100 guys go off to look for something when you know the link, and you know what works and what doesn't...post it if you do.
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC