Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : PAL/NTSC
Page 3 of 4 | |||||
Author | Message | ||||
Keith W. Senior Member Joined: 09/10/2011 Location: AustraliaPosts: 118 |
Hi Ken, I am fairly confident with the numbers and cannot “yet” find other places that must be adjusted. It may be that we have a subtle quirk. I am not great at C or Pics. I now have a copy of Lucio Di Jasio’s book on PIC 32 C which has a clear description for creating video, for Pic C coders anyway. Geoff G has changed the code a little in embracing mode switching. Ken are you indicating that there is more than one sync pulse per field, i.e. every 16.7 milliseconds for NTSC? (20 milliseconds for PAL). Geoff has altered the timing to move the active display 8 lines lower on the screen than in the book but this is likely more correct. At 31 lines on top and 15 lines below for NTSC it should still work? I will look later with an oscilloscope at the PAL timing but think that I will find it OK. Unfortunately I have more urgent tasks right now. If given a copy of a program from Geoff that I can load I will look at the waveform. Keith W. |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
Keith, Attached is a version (2.6E) which uses your timings for NTSC composite. I don't think that it is right looking at my scope but I don't have the time to sort it out now, perhaps someone can offer some changes. 2011-10-22_131153_Maximite_2.6E.zip Everyone, don't use this if you want PAL composite. Later I will figure out how to switch between PAL and NTSC but this one is nailed to NTSC for the composite output. Geoff Geoff Graham - http://geoffg.net |
||||
ksdesigns Senior Member Joined: 25/06/2011 Location: United StatesPosts: 143 |
ok don't know why but i recompiled it under MPLAB-X on my mac and it works now Dont look so good but no vertical roll now. These values work only 16 lines 18 you will lost on top and bottom. ken #define C_VRES 192//216 // Vert graphics resolution (pixels) #define C_HRES 304 // Horiz graphics resolution (pixels) #define C_LINE_N 262//312 // number of lines in PAL frame #define C_LINE_T 5084//5120 // Tpb clock in a line (64us) |
||||
Keith W. Senior Member Joined: 09/10/2011 Location: AustraliaPosts: 118 |
Hi, I have loaded the V2.6E software from Geoff and tried it to a 20 inch Teac color TV. Immediate sync up and I can easily view 50 characters by 18 lines of text. I did not adjust the TV. Unfortunately there is a slight jitter of the characters compared to the PAL signal to the same TV. I am not surprised to see 18 lines, and think that Ken’s monitor may be over-scanned. On my TV the NTSC display used more vertical screen space than PAL but there was an adequate margin. I could view the video waveforms readily with my oscilloscope and observed the correct timing within the limits of the instrument. It is not young (nor am I) but a dual trace 65 MHz with delayed sweep and a TV sync and calibrated. I looked carefully at the expanded sync of the NTSC signal, searching for a reason for the jitter but found nothing incorrect (yet). My composite video waveform was nearly 700 millivolts when terminated in 75 ohm. This should be about 1 volt. My Dontronics SM1 has the clamping diode U3 fitted (.7V clamp) but I do not wish to remove my surface mount diode. Perhaps 40% more sync level may remove the jitter, could someone try this. When testing composite video remove any VGA monitor. I am still thinking about the jitter. Perhaps a small number tweak could help? I have photographs of waveforms but include only the Teac NTSC display here to show 18 lines by 50, I think myself also. Not yet the final answer, also that Ken should have a problem with a compiler is a worry, but not a unique experience. How to switch between composite video modes? Having selected by the jumper that composite video is required, and at power-up no video viewable (wrong mode). By pressing a particular key or keys a ram flag is set and the Maximite restarts, finds the flag set (with a checksum) and boots to the alternate composite mode. Now with video available an Autorun.bas file can be created. The Autorun file might contain only the word NTSC. With some eeprom or a RTC ram the autorun file is redundant, though (if required) the same method used to select the alternate composite video mode initially. I wish a battery backed RTC including ram to be standard? Keith W. |
||||
donmck Guru Joined: 09/06/2011 Location: AustraliaPosts: 1313 |
We looked at this on the DuinoMite design, but had left it a little late, as we hadn't decided on a final RTC clock part, when the schematics were finalized. Can be added via the UEXT header, and we will have boards available, but it is an additional option. So standard Maximites, and DuinoMites don't have spare ram bytes at this point of time. Cheers Don... https://www.dontronics.com |
||||
Keith W. Senior Member Joined: 09/10/2011 Location: AustraliaPosts: 118 |
HI, I can see jitter in NTSC video but not the line sync pulse. Not easily. Yesterday I had my oscilloscope triggered from the video sync which would likely mask any jitter in the sync itself. Today I have the oscilloscope triggered from my Digital Synthesizer which is stable and accurate to a fraction of a cycle. Unfortunately I can only adjust it by the cycle per second so the video waveform drifts slowly through, even on PAL which has a line rate of exactly 15,625 Hz. The crystal oscillators in the Maximite and my synthesizer are not exact. I had thought to trigger the oscilloscope from the audio output of the Maximite which would mean that there was no relative drift but because of the funny numbers used by NTSC the audio output would not help. The drift is a nuisance, without it I could be more certain. Anyway the result is that the Maximite’s line rate is within a cycle of 15,625 Hz for PAL and 15,736 Hz for NTSC. The calculated value for NTSC with an 80 MHz clock divided by our factor gives exactly the required 63.55 Microseconds which translates to 15,735.6412 Hz. Although the waveform is drifting I think that the edges of the line sync pulses seem steady for NTSC as for PAL but that there is jitter in the video of the NTSC text. Why is it so, the start of the video output should be at a fixed clock count relative to the sync? The jitter is much more than 1/80 MHz, more like a pixel time which I think is 11 clocks and why is this only occurring for NTSC when the time to start displaying text has not changed relative to PAL? The time for a complete NTSC line is only about 1 part in 100 quicker, 0.45 microseconds in 64. I will think more but over to the code cutters for help. Something to try would be to return the line rate for NTSC to 64 microseconds as for PAL, I think the monitor is bound to lock to try, but does it fix the jitter? Keith W. |
||||
paceman Guru Joined: 07/10/2011 Location: AustraliaPosts: 1329 |
Keith, I know nothing about this stuff but my little four year old media player (Dvico TViX M-4100) seems to use a silmilar system. They're made in Korea and sold worldwide with frequent-ish firmware updates that often upset (re-set?) TV modes. The User Guide instructs to "keep pressing the TV OUT" button on the remote (our case keyboard?) until the TV is working (syncing?) correctly. Once you can see things properly, the "setup" (config'n?) can be changed for many parameters and then saved. Greg |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
I think that I might have cracked NTSC with the help of Keith Williams. If anyone out there has a pure NTSC TV or monitor could you please test this for me. 2011-11-13_205621_Maximite.zip If you want to experiment, these are the settings: // Parameters for NTSC composite video
// Graphics is 304x180 pixels. This gives us 50 chars per line and 15 lines per screen #define C_VRES 180 // Vert graphics resolution (pixels) #define C_HRES 304 // Horiz graphics resolution (pixels) #define C_LINE_N 262 // number of lines in NTSC frames #define C_LINE_T 5080 // Tpb clock in a line (63.55us) #define C_VSYNC_N 3 // V sync lines #define C_VBLANK_N (C_LINE_N - C_VRES - C_VSYNC_N) // Nbr of blank lines #define C_PREEQ_N ((C_VBLANK_N/2) - 8) // Nbr blank lines at the bottom of the screen #define C_POSTEQ_N (C_VBLANK_N - C_PREEQ_N) // Nbr blank lines at the top of the screen #define C_PIX_T 11 // Tpb clock per pixel #define C_HSYNC_T 374 // Tpb clock width horizontal pulse #define C_BLANKPAD 8 // number of zero words (4 bytes each) before sending data Geoff Graham - http://geoffg.net |
||||
donmck Guru Joined: 09/06/2011 Location: AustraliaPosts: 1313 |
Thanks Geoff and Keith. I know Circuit Gizmos is sweating on this one, so I'll forward him a message to make sure he has the information, and he should be able to test it before the NASCAR sprint cup, which starts in an hour. Cheers Don... https://www.dontronics.com |
||||
CircuitGizmos Guru Joined: 08/09/2011 Location: United StatesPosts: 1425 |
It works! Thanks, Geoff and Keith! My picky hardware accepts the timing for this NTSC. I have a picture but I have troubles uploading the pic. Is there an OPTION NTSC command? Micromites and Maximites! - Beginning Maximite |
||||
donmck Guru Joined: 09/06/2011 Location: AustraliaPosts: 1313 |
Is there an OPTION NTSC command? Or my previous suggestion of an autoset.cfg file: autoset.cfg OPTION NTSC OPTION COMPOSITE On power up, the system looks for the autoset.cfg file on Drive A:, then Drive B: If it doesn't find it, PAL and VGA are selected as the defaults. If it does find it, then the new parameters are set. Sort of like BIOS settings on a PC. Is that workable? Cheers Don... https://www.dontronics.com |
||||
CircuitGizmos Guru Joined: 08/09/2011 Location: United StatesPosts: 1425 |
Don: Why not just put that in autoexec.bas? 10 OPTION NTSC Edit: Or it it that it has to happen early? Micromites and Maximites! - Beginning Maximite |
||||
donmck Guru Joined: 09/06/2011 Location: AustraliaPosts: 1313 |
10 OPTION NTSC Edit: Or it it that it has to happen early? Yes, you need to set up the operating parameters to be able to use an NTSC TV as the output device, so you can write your autoexec.bas program. It is a bit of a catch 22, but if you have a config file, you can set and forget it, and not need to keep transferring the parameters to every autoexec.bas file you create. You can pass an autoexec.bas between countries, and the user will know he has to set his local parameters in the config file to be able to view it, and not have to edit the autoexec.bas file. In fact if it was adopted, his local parameters would already be set in the Maximite config file.. Cheers Don... https://www.dontronics.com |
||||
CircuitGizmos Guru Joined: 08/09/2011 Location: United StatesPosts: 1425 |
There is always the USB connection to use even if the "wrong" video output is set. If you screw up and set PAL here in the States, that is how you would fix it. Micromites and Maximites! - Beginning Maximite |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
That is great, thanks all. For anyone who needs NTSC that version should do for the moment. In the next version I will implement an option select so that we will have a single version of MMBasic which can be switched to NTSC. Geoff Graham - http://geoffg.net |
||||
donmck Guru Joined: 09/06/2011 Location: AustraliaPosts: 1313 |
For anyone who needs NTSC that version should do for the moment. In the next version I will implement an option select so that we will have a single version of MMBasic which can be switched to NTSC. Geoff, thanks for persevering with this. I know many users that will appreciate your efforts, and the input from Keith and others also. I can start deleting my mentions on web pages of NTSC not yet available. Cheers Don... https://www.dontronics.com |
||||
wizard Newbie Joined: 29/07/2011 Location: United StatesPosts: 38 |
Hi Geoff, Another NTSC option idea worth mentioning is: Use a 3rd state on the existing VGA/PAL select pin. Ground, +3.3V and open or tied to some nearby pin or resistor as the 3rd state. This technique can be easily extended to obtain multiple input choices with one input pin. I bet Don has seen this used in the early days when pins were very $$ and needed to be conserved. I have. warm regards, Wiz |
||||
CircuitGizmos Guru Joined: 08/09/2011 Location: United StatesPosts: 1425 |
Right now the header connects to ground and an input pin. I suppose the design could be changed, but the people with current hardware would lose out. And I'm pretty sure that people with older hardware design would be confused/upset and want a software solution. Micromites and Maximites! - Beginning Maximite |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
Use a 3rd state on the existing VGA/PAL select pin. Ground, +3.3V and open or tied to some nearby pin or resistor as the 3rd state. The problem with this is that I could not find another pin to easily jumper to and soldering the jumper lead to the board seemed messy. I have ended up with OPTION CONFIG NTSC which rewrites the flash for NTSC. This option differs from other options. It permanently reconfigures MMBasic and only needs to be run once (ie, the setting will be remembered even with the power turned off). You can use OPTION CONFIG PAL to revert if you want to. This requires some way of getting to MMBasic first, probably by USB. But, as you need USB to reflash the MM anyway, I did not think that this would be too much of an issue. This facility should appear in the next version of MMBasic. Geoff Graham - http://geoffg.net |
||||
donmck Guru Joined: 09/06/2011 Location: AustraliaPosts: 1313 |
Thanks Geoff, The OPTION CONFIG makes it very straight forward and should be fool proof. Cheers Don... https://www.dontronics.com |
||||
Page 3 of 4 |
Print this page |