NTSC Timing issues
Yanir
Posts: 11
Hi all, I posted a similar question earlier, thanks again to all who helped out, i am on the right track but I am running into another roadblock.
I wrote some code that is basically a DA converter that generates 3 voltage levels, 0v, .33v, and 1v. Those of you familiar with TV analog signals will know that 0v-1v is the range that the TV interprets as info.
Following some guides on timing protocols I seemingly am generating the correct signals. I wrote a subroutine that creates a delay of 1u and use that (along with a couple of NOP's) to create precise timing. I am taking all calls and jmps into account. I am only generating horizontal sync pulses right now, and my first goal to create a white screen. However I am creating two pairs of vertical lines composed of dots. The first in the pair is faint (i didnt' even notice it for a couple of hours) and the second is bright. The first pair in near the left edge of the TV and the second set is to the right of the center. They slide down the screen becuase I am not sending a vertical sync pattern.
My voltage is constant, I can't imagine why I would be getting this strange pattern.
Two thoughts:
1. When I step or walk through my code, it ocasionaly jmps to some random place in memory with no commands and never returns to the code (this seems to occur on the jmp to main.
2. I have my processor set at 50mhz, resulting in a 20ns cycle, are there other settings i need in place to ensure this performance?
Thanks again in advance
Yanir
I wrote some code that is basically a DA converter that generates 3 voltage levels, 0v, .33v, and 1v. Those of you familiar with TV analog signals will know that 0v-1v is the range that the TV interprets as info.
Following some guides on timing protocols I seemingly am generating the correct signals. I wrote a subroutine that creates a delay of 1u and use that (along with a couple of NOP's) to create precise timing. I am taking all calls and jmps into account. I am only generating horizontal sync pulses right now, and my first goal to create a white screen. However I am creating two pairs of vertical lines composed of dots. The first in the pair is faint (i didnt' even notice it for a couple of hours) and the second is bright. The first pair in near the left edge of the TV and the second set is to the right of the center. They slide down the screen becuase I am not sending a vertical sync pattern.
My voltage is constant, I can't imagine why I would be getting this strange pattern.
Two thoughts:
1. When I step or walk through my code, it ocasionaly jmps to some random place in memory with no commands and never returns to the code (this seems to occur on the jmp to main.
2. I have my processor set at 50mhz, resulting in a 20ns cycle, are there other settings i need in place to ensure this performance?
Thanks again in advance
Yanir
Comments
Question 1: Sounds like your jumping to another code page.
Question 2: Use TURBO in the DEVICE settings.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out· the "SX-Video Display Module"
www.sxvm.com
·
device··sx28l,oschs3
device··turbo,stackx,optionx
IRC_CAL··IRC_fast
reset··Main
freq··50_000_000·;50 mhz 50_000_000
··org··$08
;output··=·rb.0
cycle_cnt··ds·1
delay_cnt··ds·1
set_cycle_cnt··ds·1
org··$008
Delay
delay_loop·mov·cycle_cnt,#16 ;11····;loop for number of ms, specified in w
micro_loop·djnz·cycle_cnt,micro_loop·;loop for 1027 ns = 1.027 ms
··ret
org··$100
Main
init
··mov·!rb,#0
··clr·rb
·; for 4.7 ms send HSync 0v
··;cje·rc,%0,Flip
··;mov·w,#4
main_loop·call·Delay····;1u
··call·Delay····;1u
··call·Delay····;1u
··call·Delay····;1u
··;34 nop's and setb for .7u
··nop·····;.02u
··nop·····;.02u
··nop·····;.02u
··nop·····;.02u
··nop
··nop
··nop
··nop
··nop·····;.10u
··nop
··nop
··nop
··nop
··nop·····;.10u
··nop
··nop
··nop
··nop
··nop·····;.10u
··nop
··nop
··nop
··nop
··nop·····;.10u
··nop
··nop
··nop
··nop
··nop·····;.10u
··nop
··nop
··nop
··nop
··nop·····;.10u··Yotal NOPs .68
··setb·rb.0····;.02u··;swapped
··;mov·w,#8· ; Back Porch 5.9u
··call·Delay
··call·Delay
··call·Delay
··call·Delay
··call·Delay····;5u
··nop
··nop
··nop
··nop
··nop·····;.10u
··nop
··nop
··nop
··nop
··nop·····;.10u
··nop
··nop
··nop
··nop
··nop·····;.10u
··nop
··nop
··nop
··nop
··nop·····;.10u
··nop
··nop
··nop
··nop
··nop·····;.10u
··nop
··nop
··nop
··nop
··nop·····;.10u
··nop
··nop
··nop
··nop
··nop·····;.10u
··nop
··nop
··nop
··nop
··nop·····;.10u
··nop
··nop
··nop
··nop·····;.08u
··;nop
··setb·rb.1····;.02u
··;mov·w,#52 ; Visible Image 51.5
··call·Delay
··call·Delay
··call·Delay
··call·Delay
··call·Delay····;5u
··call·Delay
··call·Delay
··call·Delay
··call·Delay
··call·Delay····;5u
··call·Delay
··call·Delay
··call·Delay
··call·Delay
··call·Delay····;5u
··call·Delay
··call·Delay
··call·Delay
··call·Delay
··call·Delay····;5u
··call·Delay
··call·Delay
··call·Delay
··call·Delay
··call·Delay····;5u
··call·Delay
··call·Delay
··call·Delay
··call·Delay
··call·Delay····;5u
··call·Delay
··call·Delay
··call·Delay
··call·Delay
··call·Delay····;5u
··call·Delay
··call·Delay
··call·Delay
··call·Delay
··call·Delay····;5u
··call·Delay
··call·Delay
··call·Delay
··call·Delay
··call·Delay····;5u
··call·Delay
··call·Delay
··call·Delay
··call·Delay
··call·Delay····;5u
··call·Delay····;1u
··;call·Delay
··nop
··nop
··nop
··nop
··nop·····;.1
··nop
··nop
··nop
··nop
··nop·····;.1
··nop
··nop
··nop
··nop
··nop·····;.1
··nop
··nop
··nop
··nop
··nop·····;.1
··nop
··nop
··nop
··nop·····;.08
··;nop
··clrb·rb.1····;.02
··;front porch 1.4u
··call·Delay····;1u
··nop
··nop
··nop
··nop
··nop·····;.1u
··nop
··nop
··nop
··nop
··nop·····;.1u
··nop
··nop
··nop
··nop
··nop·····;.1u
··nop·····;.02u
··clrb·rb.0····;.02u
··jmp·main_loop···;.06u
END
watch·delay_cnt,8,UDEC
watch·cycle_cnt,8,UDEC
watch·RB,8,SBIN
watch·RC,8,SBIN
Your code is running onto the next code page.
Try using "call @delay" and "jmp @main_loop" remember the '@' will cause the instruction to take an extra cycle.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out· the "SX-Video Display Module"
www.sxvm.com
·
Jim
I ported the SERVID program some years ago to be compiled with sasm.
It contains a delay macro and runtime routine.
I extracted that delay into delay.src
It is used to generate NTSC/PAL timing pulses.
regards peter
regards peter
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out· the "SX-Video Display Module"
www.sxvm.com
·
I tried the @ and that eliminated the faint dots, and I now have 3 vertical lines of dots, all seemingly equidistant.
It doesn't run to another page now, thanks Bean.
Why dots? Still puzzled.
Thanks for all the great responses. Hope there are more to come.
yanir
The servid_sx·is listed on sxlist.com ever since I did that port.
There is a link at the bottom on the servid page at sxlist.com
http://www.sxlist.com/techref/ubicom/lib/io/dev/video/servid.htm
regards peter
Post Edited (Paul Baker) : 3/10/2005 6:27:41 PM GMT
Thats 262.5 horizontal lines per field.
This is part of the Interlace Smile that NTSC uses.
The Horizontal and Vertical·Syncs have a close relationship.
Most of the Sync decoder chips rely heavily on this.
You might want to try to·do the Vertical·Timing at the same time.
(a chicken and egg thing)
Sync in NTSC can be very unforgiving.
You might want to get that timing down to at least 0.2uS.
1uS is really loose.
And don't forget... When you decide to use color, the Horizontal becomes 15.734.25 Hz and Vertical·= 59.94 Hz.
Tom M.
Here is what lines my serial video module outputs.
6 - VSYNC - Block sync for 6 lines (sync level all the time)
40 - TopBlank - Top blank lines (5uSecs of sync, rest black)
192 - Video - Active video lines (5uSecs of sync, 10uSecs left boarder, 41uSec active video, rest black)
24 - BotBlank- Bottom blank lines (5uSecs of sync, rest black)
each of these lines lasts for 65.6uSeconds (I know it's not exactly NTSC timing, but it's needed for serial comm).
I have tried my module on close to a dozen different video inputs and it has worked on all of them.
I'm not saying there may be some system that it won't work on, but NTSC is pretty forgiving.
Edit: Forgot to mention that this is strictly "black and white" video output.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out· the "SX-Video Display Module"
www.sxvm.com
·
http://www.sxlist.com/lib/io/dev/video
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
---
James Newton, Host of SXList.com
james@sxlist.com 1-619-652-0593 fax:1-208-279-8767
SX FAQ / Code / Tutorials / Documentation:
http://www.sxlist.com Pick faster!
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out· the "SX-Video Display Module"
www.sxvm.com
·
Yanir