로그인회원등록 내글장바구니주문조회현재접속자
 상품 검색








 게시판 검색





 
 
회원등록 비번분실


온라인 입금계좌
ㆍ기업은행
ㆍ219-043192-01-028
ㆍ이건영

      거래은행 바로가기
 
 SX, MPU Applications
SX, MPU 자료실
작성자 leeky        
작성일 2006/03/16
첨부#1 sxsys_game_src.zip (0KB) (Down:49)
첨부#2 tetris_ntsc_shot.jpg (0KB) (Down:25)
Link#1 howto.php (Down:44)
ㆍ추천: 4  ㆍ조회: 2838   
  SX color TV 게임기

SX-Tetris

테트리스 회로, 소스
http://www.rickard.gunee.com/projects/video/sx/sxtetris.zip
 
핑퐁 회로, 소스
http://www.rickard.gunee.com/projects/video/sx/sxpong.zip
 
NTSC 방식의 영상신호를 만드는 방법을 설명한다.
http://www.rickard.gunee.com/projects/video/sx/howtocolor.pdf
 
이 자료는 SX 칩으로 만든 기판을 NTSC TV에 연결하여 게임을 한다.
먼저  NTSC 방식의 영상신호를 만드는 방법을 설명한다.
SX28로 만든 기판으로 2가지 TV 게임기를 만든다.
 
 
 
주사선(scan line)과 비월(interaced) 주사(scan)
표준 TV는 2개 분리된 화면으로 부터 하나의 영상을 만든다.
각각의 화면은 매번 교차되어 1초에 30 번씩 모두 60번 들어온다.
 
 


TV 표준
지도에서 다른 표준을 사용하는 국가를 보여준다.
 
 

아날로그  TV의 표준은 NTSC, SECAM, PAL 이 있다. NTSC는 "국제 TV 장치 협회"의 약자이다.
NTSC의 주사선은 525개로, 화면의 갱신속도는 30Hz 이다.
SECAM은 "Sequential Color And Memory"의 약자로 프랑스의 표준이다.
SECAM은 색상의 안정도는 좋으나 분해능이 떨어진다.
유럽의 표준 PAL은 "Phase Alternating Lines"의 약자로, 625개의 주사선을 25Hz로 방송한다.
물론 PAL의 표준도 NTSC에서 파생된 것이나, 개선점은 색상의 오류를 매 라인마다 제거한다.

영상신호
1초에 25~30 번 이하의 화면을 전송하면, 화면이 깜빡거리는 Flicker 현상이 나타난다.
그래서 1번은 1,3,5,7,9,,,로된 홀수선의 수평 영상을 화면을 표시하고
또 한번은 2,4,6,8,,,로된 짝수선의 수평영상을 화면에 표시해서 플리커를 개선한다.
 
동기신호
연상신호는 0~1V 이다, 0.3V 는 흑색이다. 0~0.3V는 동기신호이다.
수평동기 신호는 1초에 525번 나타나고, 수직동기는 1초에 30번 나타난다.
수평동기 신호보다 넓은 수직동기에는, 겉보기 주파수를 높이기 위한 동기펄스가 들어간다.
 
 
 
주사선에 포함된 영상신호
An image is built from 625scanlines, but a TV doesn't show 625 lines.
Some of the lines are used for synchronization pulses, and some lines are invisible
because old TVs needed some time to move the electron beam from the bottom of the screen.
(Those invisible lines are nowadays used for other purposes, Text-TV for example).
 
아래 그림은 2개의 주사선에 올라탄 영상신호를 보여준다.

 
 


수직동기 신호
To tell the TV that a new image is coming, a special pattern of synchronization pulses is sent.
Since the picture is built from two half pictures, the pattern is different for the odd and even images.
The vertical synchronization pulses looks like this:

 

2개의 동기신호는 홀수와 짝수의 주사선에 포함된 동기신호이다.
밑에 있는 숫자는 주사선의 번호이다.

색변조
When color was introduced, it was the same problem as with any change in technology, there is always a demand for backwards compatibility that limited the new technology. For video signals this meant that a color video signal should look very much like a B&W signal so old TVs would still work. The problem was solved by overlaying the color signal with an amplitude modulated carrier on top of the video signal. In average the video signal would still be the same for B&W and it would not be noticed if the carrier had high enough frequency and the modulation also was kept to a low bandwidth.

The intensity of the TV signal is the sum of the Red, Green and Blue parts (weighted with the eyes sensitivity coefficients for those colors) in the video signal, and since that information is already given in the B&W signal then the additional color information only needs to contain two components with color difference. With the intensity sum and the two components G-R and G-B, it is possible to derive the R,B and G values. Humans have higher resolution for light intensity than for color, so using higher bandwisth for intensety than for colr variation is very appropriate. Limiting the color information to two components is especially great as it is possible to transfer two signals using quadrature modulation, making it possible to transfer color using only one carrier overlaid on the B&W video signal!

기본 원리는 4상진폭변조(4QAM)이다.
 

4상 변조
Quadrature modulation is a general method for modulation of a carrier. The idea is to change both amplitude and phase of the carrier to be able to send two signals with one carrier frequency. Each signal has its own carrier, one is sin (2pi*fc*t) and one is cos (2pi*fc*t), which makes it possible to reach all phases and amplitudes by modulating the voltages of the two signals. This method is not only used for TV color modulation, it is widely used, for example this is how stereo information is sent over radio also. It is a clever way to use the bandwidth to the maximum, with standard amplitude modulation only one channel is used, the other is just wasted. In order for this method to work, there must be a “pilot”, a reference signal that makes synchronizes the oscillator in the receiver with the one on the transmitter.

4상 변조의 방법에서 두 표준은 변조레벨이 상이하다.
나중에 나온 PAL은 CRT에 향상된 형광체를 사용한다.
색상의 감도는 무게가 주어진다, 즉 연상레벨과 변조레벨의 관계가 선형이 아니라는 뜻이다.
색상의 무게는 사람의 시감도를 보상하도록 주어진다.
 

The Y,U,V component transformation can be described as a matrix,
for PAL the matrix looks like the following:

 
 

In NTSC the U and V components are rotated 33 degrees to minimize bandwidth
for Q, the rotated components are called I and Q, calculated according this:
 
 
For NTSC the Y,I, Q components can be described using the following conversion matrix:
 
 

Putting it all together
The output is created with quadrature modulating as described before by modulating a cosine
and a sine with the U and V (I and Q for NTSC) components and sum the result together
with the lumination component Y.
For PAL there is also a change in sign of the sinus component to compensate
for phase error that will take out each other. (That is why it is called Phase Alternating Line).

The video signal is calculated according the following:
 

So the color coding is just as simple as that,
but there is one detail left, there must be a pilot signal in order for the quadrature modulating.
In most systems using quadrature modulation, the pilot signal is sent constantly as a tone in the signal,
for TVs however that would disturb the image too much.
If there is an oscillator in the TV that is very stable,
it would be enough to send a couple of cycles of the pilot periodically
for the oscillator to tune in to, just often enough for the oscillator to keep its phase.
In the B&W signal there is a gap of about 7us between the sync pulse and where the image information starts,
so it was an obvious place to put the reference carrier.
This is 10-12 cycles of the color carrier (amplitude of 20IRE = 0.15V) and referred to as the “color burst”.
 
The color burst is also shifted +-45 degrees on every scan-line for PAL.

 
 

색상발생
As you would know after reading the chapter about video signals, the software needs to create modulated sinus and cosines waveforms for color information and sum them together with the intensity waveform. To get a good result the sample rate needs to be much higher than the color carrier frequency, and the software must also be able to do the needed calculations for the waveform which in total would need a very powerful processor if there is no hardware to help. An SX processor performing 50MIPS would not be good enough using this method.

계산의 꼼수
However, there is fortunately a better way to do it.
The color carrier part of the signal is the sum of a sinus and a cosines
with the same frequency but different amplitude,
this is very fortunate as the cosines could be rewritten as a sinus
with it phase shifted 90 degrees compared to a cosines.

Ok so what good is that, well,
the sum of two sinuses with same frequency and fixed phase difference but
with varying amplitude could be rewritten as one sinus
with alternating phase and amplitude according to:
 

The coefficients preceded cos and sin describes a point on the unit circle
and could be replaced with cos and sin with the angle alpha according to:
 
 
This equals a rotation by an angle alpha according to:
 

Making it possible to express the sum of an aplitude modulated sin and cos
with one sin that is both aplitude and phase modulated.

하드웨어
Ok we got rid of one of the components but still have one sinus that needs to be generated requiring a lot of CPU power. At the input of a TV there is a low-pass filter to limit the signal within a video signals allowed bandwidth of about 5MHz, which is very good because that means that a square wave at the color carrier frequency would look like a sinus to the TV as the high frequency components of the square wave have been filtered away.

Now we are down to a square wave with changing phase, amplitude and offset,
which is possible to generate in software with an SX@50MHz if the number of phases is limited and the clock frequency is a multiple of the color carrier frequency.
In my projects I clock the SX with 12 times the carrier frequency for both PAL and NTSC, which gives 53.156550MHz for PAL and 42.954540 for NTSC, the over clocking of a 50MHz SX chip to 53MHz in the PAL case seems not to be a problem at all.

회로
 
 
Our new parameters
The simplified signal with the square wave works like this:
The average voltage of the signal control the lumination, the amplitude of the signal controls the whiteness and phase controls the color. When using 12 times the color carrier it is possible us get 12different colors with different variation in intensity and whiteness.

The first test I made with color generation was to examine the 12 base colors available,
this test I shown in the picture to the left below.

All possible variations for the 12 base phases can be seen here to the right below
where all possible values for first and second amplitude are shown for all 12 phases and five bits.
(There are25*25*12/2-25*5=3625 combinations)
 
The 12 phases, generates these 12 base colors.
 
 

The available colors for 5bit DA and 12 phases.
 

영상출력 회로
신호의 발생은 DA-변환기가 필요하다, 간단한 저항기반의 DA를 만든다. 
저항기반의 DA에는 2 종류가 있다 , 2N-net과 R2R-ladder 이다. 2N 망은 가단하다.

2N DA 변환회로.
 

2N-망은 복잡하다, R2R-ladder는 2배의 저항이 필요하다. 그러나 더 정밀도가 높다.
 
R2R DA 변환회로
 

5 비트 DA는 0~1.25V를 출력한다.
2R은 440 옴, R은 220 음을 사용한다.
구할 수 없다면, 220 옴과 110 옴을 사용해도 된다. 

색상의 제한
대역폭이 낮으므로, 색상을 빠르게 바꿀 수 없다, 영상 표현에 색상 위상값을 상수로 사용햇다.
그리고 매 색상 사이클마다 오직 밝기만 바꾼다. NTSC에서 분해능은 2233/12=186  픽셀이다. 
 
게임에 사용한 흑백 공 (색상 위상변화를 주어 칼라로 보인다)

  

Palette
To save memory a palette is often used in computer graphics cards. A palette is basically a color lookup table. In most cases the palette contains 2N colors, usually 16 or 256 colors to be able to get each color into a nibble or a byte. If a picture only uses 16 different colors, then it needs 6 times less memory compared to if each byte would have been stored as three 8bit values with the RGB-components if a 16 color palette is used. In my games a palette is used to need less data for some of the graphics, a 16 color palette is used, however the lookup table doesn’t store the RGB values, instead it stores high and low period values for the square wave. In other words, my palette only contains info on brightness and whiteness, the color is set by the phase of the square wave which is not stored in the palette. Only one palette is used for both my games and it stars at black level, moves to color with maximum intensity, and then moves to maximum white. (See diagram below.) This palette makes it possible to generate objects with a 3D-feeling as it is possible to make dark shadows and more illuminated parts within the same object, but the object must be “monochrome”. It is possible to generate palettes with a 180 degree phase shift and get the complimentary color, but as the bandwidth is limited it is not possible to mix colors from the two phases in any order, it takes almost one color cycle for the phase change. (If the graphics is carefully planned to get few phase shifts, this could probably be used to do some really cool two colored objects)

흑백 파렛
 
소프트웨어 내려받기
http://www.rickard.gunee.com/projects/video/sx/pong.php
http://www.rickard.gunee.com/projects/video/sx/tetris.php
 
SX-Pong
 

결론
It is possible to generate composite color video signals in software,
but it is a lot of work and it is only possible in some special cases.
NTSC is much more easy to do than PAL when doing the signal
in software as phaseshifting is better done in hardware.

The main reason for doing video in software is doing it for fun and that it is possible =),
this form of video generation has very little commercial value as
it takes huge amount of time to generate something with very poor result.
Doing software based monochrome signal colored with hardware would give
better result,
but the best result is of course done with memory mapped graphics outputted
with dedicated hardware. 

AVRTOOLS™
   
윗글 SX28 USB 분석장치 (SX-Atpapch)
아래글 SX28 Serial to TV
    N         제목    글쓴이 작성일 조회 추천
48 SXB 무료 Basic 컴파일러 SX18/20/28 avrtools™ 2008/12/03 (수) 1447 0
47 SX28 IR-Remote Signal Analyzer avrtools™ 2016/01/22 (금) 318 0
46 삼성 안드로이드폰 GT-i5700 무선 오실로스코프 avrtools™ 2011/09/10 (토) 2718 10
45 SX28 Clock Timer 소스 avrtools™ 2008/12/03 (수) 1720 0
44 SX28 Scanning a 4x4 Keypad 소스 avrtools™ 2008/12/03 (수) 1852 0
43 SX28 Thermometer 소스 avrtools™ 2008/12/03 (수) 1542 0
42 SX28 Serial LCD 소스 avrtools™ 2008/12/03 (수) 1534 0
41 SX28 Digital Dice 소스 avrtools™ 2008/12/03 (수) 1383 0
40 IDE51-C 8051 C컴파일러 (사용제한 없음) avrtools™ 2008/12/03 (수) 2192 0
39 uc51 검파일러 8K 무료버전 avrtools™ 2008/12/03 (수) 1586 0
38 SXC Demo avrtools™ 2008/12/02 (화) 1290 0
37 SxSim (UBICOM의 SASM 어셈블러를 지원) avrtools™ 2008/12/02 (화) 1470 0
36 SXkey52.exe SX48, SX52 전용 소프트 avrtools™ 2008/12/02 (화) 1343 0
35 SX 칩 프로그래머/인서킷 에뮬레이터 SXKey v3.0 avrtools™ 2008/12/02 (화) 1325 0
34 Serial port keyboard stuffer avrtools™ 2008/11/09 (일) 2028 0
33 IBM AT Keyboard의 Hexa 값 leeky 2007/11/12 (월) 2036 0
32 PC 소프트웨어 오실로스코프 avrtools™ 2008/10/07 (화) 2419 0
31 저항 읽는 방법과 저항 소프트웨어 avrtools™ 2008/09/26 (금) 2265 0
30 BMP to LCD avrtools™ 2008/09/22 (월) 1986 0
29 SX18/20/28용 무료 베이직 SXB V3.1 leeky 2006/03/03 (금) 3273 22
28 절연 RS232C 회로 avrtools™ 2008/08/29 (금) 2486 0
27 문자표시 LCD 모듈의 사용방법 leeky 2006/04/06 (목) 4238 0
26 Bin2Hex.exe leeky 2007/11/12 (월) 2535 0
25 LPT Port Tester leeky 2007/11/12 (월) 2441 0
24 PC 프린터 포트의 사용법 leeky 2007/11/12 (월) 2641 0
23 병렬포트(LPT1) 시험 소프트웨어 leeky 2007/11/12 (월) 2362 0
22 SX 칩 4비트 LCD 소스 leeky 2006/02/20 (월) 2743 30
21 SxSim (UBICOM의 SASM 어셈블러를 지원) leeky 2006/02/13 (월) 2190 27
20 SXkey52.exe leeky 2006/02/13 (월) 1977 28
19 SX 프로그래머/에뮬레이터 SXKey v3.0 leeky 2006/02/13 (월) 2143 24
18 SXC Demo Version leeky 2006/03/16 (목) 2057 27
17 SX52 웹서버 + 겜보이 카메라 leeky 2006/03/16 (목) 2284 5
16 CMUcam2 (Cam + 5 Servo) leeky 2006/03/16 (목) 2641 3
15 CMUcam Vision Sensor KIT with SX28 leeky 2006/03/16 (목) 3027 4
14 SX52 이더넷 평가기판의 소스 (iSX 소프트) leeky 2006/03/16 (목) 2878 1
13 SX52-이더넷 평가기판 (하드웨어) leeky 2006/03/16 (목) 2303 1
12 SX52 MMC(메모리카드) WAV화일 녹음과 재생 leeky 2006/03/16 (목) 2856 5
11 SX28 USB 분석장치 (SX-Atpapch) leeky 2006/03/16 (목) 2642 5
10 SX color TV 게임기 leeky 2006/03/16 (목) 2838 4
9 SX28 Serial to TV leeky 2006/03/16 (목) 2366 3
8 SX18 영상(NTSC) 동기검출 leeky 2006/03/16 (목) 2108 2
7 SX28 디지털 스코프 leeky 2006/03/16 (목) 2487 3
6 SX28 500KHz DDS 신호발생기 leeky 2006/03/16 (목) 2572 0
5 SX Morse Code Keyer avrtools 2006/03/16 (목) 1862 2
4 SX28 Video OSD Module leeky 2006/03/16 (목) 2760 0
3 1.2MHz/2.4GHz Exciter leeky 2006/02/25 (토) 2153 0
2 16F84 G3RUH 9600BPS Modem leeky 2006/02/25 (토) 2242 2
1 16F84 Morse Decoder leeky 2006/02/25 (토) 3068 1
1

바구니 : 0
 보관함 : 0
오늘뷰 : 0
HOME   |   회사소개   |   제휴안내   |   회사위치   |   서비스이용 약관   |   개인정보 보호정책   |   사이트맵
17015 경기도 용인시 기흥구 동백중앙로16번길 16-25, 508호. 전화 : 031-282-3310
사업자 등록번호 : 697-47-00075 / 대표 : 이건영 / 업태 : 제조업 / 종목 : LED조명, LED전원, 제어장치.
개인정보 관리책임자 : 홈페이지 관리자 . Copyright ⓒ2016 아크레즈 (ACLEDS INC.)
HOME TOP PREVNEXT 0 0 0