Sync |
|
Horizontal sync is generated by
OC1 (Output Compare 1) register, which is syncronized to T1 (Timer 1). For the
full horizontal clock syncronization, special routine is executed after each
horizontal sync signal, otherwise permanent horizontal jitter would be
generated. This routine is very important in software driven video signal, and
it computes (blue) and executes (red) the series of NOPs to get proper
horizontal timing. Vertical sync is generated by software. Timer 2 generates interrupts in variable timing periods, and it services four different events:
1. Vertical sync (one dummy line plus two lines)
Each of those events is initiated by T2 (Timer 2) interrupt. Special counter (VGATASK), which counts interrupts in the range 0...3, determines which routine will be executed. At the end of that routine, the number of lines (timing until next routine) is written to PR2, so that T2 triggers new interrupt at the right moment. These timing may be used to adjust vertical position of each picture portion. Red coordinates on the previous picture signify the periods in which the non-interrupt program code (game scenario and logic, keyboard scan, pointer and sprite servicing, etc) is executed. Black ondes belong to the video sync (black line at the top of the drawing) routine, monitor auto adjusting markers (two blue lines at the top), main image and bottom line text. Blue coordinates (1 lines each) are for timing syncronization. The polarity of both sync signals is positive. Although 24E-series PIC MCU use only 3.3 V power supply, some port pins are 5V tolerant, not only as input, but also as output, when they are defined as Open Drain output pin. In that case, pull-up resistors to +5 V are used to define high output voltage level. |
|||
|