decodificador closed caption

23
8/12/2019 Decodificador Closed Caption http://slidepdf.com/reader/full/decodificador-closed-caption 1/23 Decodificador CLOSED-CAPTION Esta nueva técnica de mensajes en pantalla denominada closed caption est! presente tanto en emisiones "ra#adas de T$ as% como en transmisiones en vivo& Incluso es posi#le "ra#ar con e'uipos domésticos la se(al de v%deo sin 'ue ello impli'ue perder la informaci)n closed caption& Los televisores e'uipados de f!#rica con decodificaci)n closed caption inclu*en la circuiter%a necesaria para superponer en pantalla los mensajes reci#idos& En nuestro caso reali+aremos un receptor de closed caption 'ue toma la se(a proveniente de una v%deo "ra#adora o sintoni+ador * la muestra en una PC por medio del puerto serie ,S.& /n pro"rama terminal convencional e0plora el puerto serie * muestra la informaci)n reci#ida en pantalla& Cuando una se(al con t%tulos closed caption es reci#ida un LED se ilumina para indicar ese estado& El circuito completo se alimenta de 1vcc 2TTL compati#le3 * consume alrededor de 455mA& La se(al de v%deo inicialmente es filtrada para 'uitar los posi#les ruidos presentes en la ma*or%a de las se(ales "ra#adas domésticamente& Lue"o es in*ectada al inte"rado separador de sincronismos 261743 para descomponer la se(al ori"inal& El terminal CS8NC 'ue presenta un estado #ajo durante el per%odo de sincronismo in"resa al terminal PA. 2pin 3 del microcontrolador& S)lo la se(al compuesta de sincronismo es empleada en el sistema& Las dem!s se(ales son sinteti+adas dentro del 9C a fin de reducir la cantidad de terminales a emplear&

Upload: karlosmarcony

Post on 03-Jun-2018

243 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 1/23

Decodificador CLOSED-CAPTION

Esta nueva técnica de mensajes en pantalla denominada closed caption est! presentetanto en emisiones "ra#adas de T$ as% como en transmisiones en vivo& Incluso es posi#le

"ra#ar con e'uipos domésticos la se(al de v%deo sin 'ue ello impli'ue perder lainformaci)n closed caption& Los televisores e'uipados de f!#rica con decodificaci)nclosed caption inclu*en la circuiter%a necesaria para superponer en pantalla los mensajesreci#idos&

En nuestro caso reali+aremos un receptor de closed caption 'ue toma la se(a provenientede una v%deo "ra#adora o sintoni+ador * la muestra en una PC por medio del puerto serie,S . & /n pro"rama terminal convencional e0plora el puerto serie * muestra lainformaci)n reci#ida en pantalla& Cuando una se(al con t%tulos closed caption es reci#idaun LED se ilumina para indicar ese estado&

El circuito completo se alimenta de 1vcc 2TTL compati#le3 * consume alrededor de455mA&

La se(al de v%deo inicialmente es filtrada para 'uitar los posi#les ruidos presentes en lama*or%a de las se(ales "ra#adas domésticamente& Lue"o es in*ectada al inte"radoseparador de sincronismos 261743 para descomponer la se(al ori"inal& El terminalCS8NC 'ue presenta un estado #ajo durante el per%odo de sincronismo in"resa al

terminal PA. 2pin 3 del microcontrolador& S)lo la se(al compuesta de sincronismo esempleada en el sistema& Las dem!s se(ales son sinteti+adas dentro del 9C a fin dereducir la cantidad de terminales a emplear&

Page 2: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 2/23

El circuito inte"rado EL6174 es una revisi)n mejorada del L:4774& O#sérvese 'ue el6174 tra#aja muc;o mejor 'ue el L:4774 cuando la se(al disponi#le no es )ptima 2talcomo sucede con se(ales "ra#adas con e'uipos domésticos3&&

/n oscilador a 5 :<+ permitir%a procesar la se(al de v%deo de forma mas precisa peroesto re'uerir%a muc;a mas cantidad de memoria de tra#ajo para almacenar la informaci)n

temporal cosa 'ue en la ma*or%a de los PICs de prop)sito "eneral no ;a*&

Los datos o#tenidos son nuevamente seriados esta ve+ en cadenas de datos ,S . *enviados por medio los pines = * > del micro& La tensi)n ne"ativa re'uerida para cumplircon las normas ,S . son "eneradas por medio de los capacitores * diodos conectadoral terminal = del micro&

Los interruptores de confi"uraci)n usan los resistores de Pull/p del micro por lo 'ue no;ace falta colocarlos afuera& Dado 'ue no ;an sido implementados en esta revisi)n delsoft?are su cone0ionado es optativo 2o innecesario3&

El led conectado al terminal P@6 del micro #rilla ante la presencia de datos closed captionen la se(al de v%deo& Los otros dos leds a n no tienen funci)n por lo 'ue su instalaci)n esoptativa&

El micro funciona a 4= :<+& Lo 'ue es li"eramente inferior a . veces los 15. B<+ 'uees la frecuencia empleada en closed caption&

Para el prototipo se us) un PIC4=C76 de la firma :icroc;ip& Si #ien este componente esmu* c)modo para pro"ramar 2por su memoria EEP,O:3 est! especificado para funcionara 45 :;+ no a 4= :<+ como se est! ;aciendo a'u%& A temperatura am#iente contensiones * valores t%picos etc etc etc&&& el c;ip funciona& Pero es recomenda#le emplearel PIC4=C=4&

Para o#tener el c)di"o ensam#lador del micro ;a"a clic a'u%&

Theory of operation for the PIC ClosedCaption Decoder

Eric Smith and Richard Ottosen

[email protected] http://www.spies.com/~eric/ 9/18/95

op!right 1995 Eric Smith and Richard Ottosen

"hat is a c#osed caption decoder$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#osed captioning is done on a num&er o' () transmissions 'or the &ene'it o'the hearing impaired. (he captions ma! &e prerecorded with a scripted programor added #i*e as with a news &roadcast. (he captioning is on#! a*ai#a&#e with

a specia# decoder. (he c#osed caption decoder ta+es this hidden in'ormationand disp#a!s it. (he decoding is norma##! done inside a te#e*ision recei*erand o*er#a!ed on the picture &eing captioned.

Page 3: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 3/23

,ow to use the - c#osed caption decoder%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(his *ersion a c#osed caption decoder ta+es its signa# 'rom the *ideo outputo' a ) R and disp#a!s the captions on a persona# computer using a seria#RS% 0 port and running a termina# program. Since the ) R records the entire*ideo signa# the decoder wor+s &oth with o'' the air and recorded programs.2n 3E4 #ights whi#e a program is &eing c#osed captioned.

ac+ground%%%%%%%%%%

67. . (his section needs a #ot o' wor+(he &asic operation o' c#osed caption decoding is... ...#ine 1......run%in... ...seria# character pair on each #ine... ...commands...

Re'erences%%%%%%%%%%

ui#d the (e t;ra&&er E#ectronics 7ow 7o*em&er 199< pg 01.-ro=ect circuit ta+es &ase&and *ideo in and outputs RS% 0 caption.Some in'ormation on how caption wor+s interesting imp#ementation.

E p#oring the )ertica# #an+ing nter*a# (he omputer 2pp#ications >ourna#: 2pri# 199< pg <.

4iscusses se*era# di''erent te t and graphic standards. Shows how todecode se*era# o' the te t 'ormats. ;ood in'ormation to get startedunderstanding c#osed captioning.

#osed aptioning with the ?otoro#a 8, A5 1 (he omputer 2pp#ications >ourna# ?a! 1990 pg 1 .

Bses custom microprocessor 'or p#acing captions on te#e*ision screen.,ard to e periment with specia# processor. ;ood re'erences in artic#e.

3ine 1 4ata Ser*ices 'or 7(S E#ectronic ndustries 2ssociation E 2% A8 199 .

(he standard 'or c#osed captioning in the B.S.

-ower supp#!%%%%%%%%%%%%

B1 an 3? 901%5 #ow dropout regu#ator ta+es the nomina# C9 *o#ts andregu#ates it down to C5 *o#ts. (his regu#ator is designed to withstandre*ersed input *o#tage. 1 must &e nonpo#ariDed to a#so hand#e a re*ersedpo#arit! input *o#tage. ' a 83A5 t!pe regu#ator is su&stituted a 17<AA1diode shou#d &e added in series with the positi*e &atter! termina# Fanode to&atter!G to protect the regu#ator and circuit 'rom a momentari#! re*ersed&atter!. ' a 9 *o#t 4 wa## trans'ormer is used the a&o*e precautions arenot needed.

(he input power is e pected to &e a&out C9 *o#ts at 1AAma:

Re' 7um&er (!pica# ?a imum%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%B1 3? 9012H%5 0. ma 1A.9maB - 1 1 . ma 10. maB0 E#antec E3<581 1. ma 0.AmaB< 3?090 A.<ma 1.AmaI1 75A88 A.0ma A. ma

Page 4: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 4/23

I /I0 @ 709A .Ama .AmaR</R -u##ups 5.Ama 1A.Ama45/4 /4 3E4Js .Ama 9.AmaS1/S /S0 Switches A.Ama A. ma

%%%%%% %%%%%% 0A.<ma 5<. ma

S!nc stripper%%%%%%%%%%%%%

(he *ideo is 'i#tered to reduce the e''ects o' noise impu#ses on theo''%the%air () *ideo. (he 'i#tered *ideo is app#ied to the input o' theE3<581 FB0G which strips o'' the composite s!nc 'or the micro to use. (he

SK7 pin which is #ow during the s!nc period goes into -20 Fpin o' B G.7ote that the RSE( pin does not ha*e the usua# resistor and capacitor pairconnected. (hese parts are not needed i' no 'ie#d or 'rame signa#s are needed'rom the E3<581. On#! the composite s!nc 'rom the s!nc stripper is used. (heother signa#s are s!nthesiDed inside the micro thus 'reeing up pins on themicro. Since on#! a s!nc stripper is needed a crude and cheap s!nc strippingcircuit using discrete components cou#d &e used in situations with a *er!c#ean *ideo signa#. (he E3<581 is an impro*ed *ersion o' the 3?1881 ando&ser*ations show that the E3<581 per'orms much &etter than the 3?1881 when#ess than idea# o'' the air signa#s are &eing recei*ed.

(he 'i#tered *ideo is a#so app#ied to emitter 'o##ower I1. I1 o&tains its&ias F1.0 *o#ts to 1.9 *o#tsG 'rom the *ideo c#amp at the E3<581 *ideo inputpin. I1 is used to pre*ent 4 restore pu#ses 'rom 'eeding g#itches &ac+ intothe s!nc stripper. ?icro output -2 FB pin 1G is pu#sed #ow during the *ideo&#an+ing periods. (his charges cap to the di''erence &etween the 2coup#ed *ideo &#an+ing potentia# and ground. wi## ho#d this *o#tage 'orse*era# () #ines +eeping the &#an+ing #e*e# at ground indepenant o' the*ariations in a*erage &rightness o' the *ideo. R0 sources a sma## current toensure that the -2 c#amp a#wa!s pu##s toward ground. Resistor R1< #imits the4 restore current to reduce g#itches on the *ideo and s#ow the 4 restoreresponse time to more than 1 () #ine.

"hen the *ideo has &een 4 restored the *ideo is #e't dri*ing -2 as aninput. 7orma##! !ou shou#dnJt put an ana#og signa# into a digita# input. nthis case since the c#amped *ideo is a ma imum o' a&out A. * the increase inoperating current is accepta&#e.

4ata s#icer%%%%%%%%%%%

One ha#' o' the *o#tage comparator FB<2G is used as a pea+ detector. ?icropin -21 contro#s the pea+ detector to catch pea+s when the c#osed caption datais present in the *ideo. (o catch the pea+s o' the c#osed caption the pea+detect capacitor is discharged =ust &e'ore the start o' the run%in c!c#es.(he output o' the comparator is open co##ector so R< supp#ies the chargingcurrent 'or ho#d capacitor 8. 4iode 41 pre*ents discharge o' the pea+ho#ding capacitor &! the comparator output &etween pea+s. ap 8 is chosensma## enough in *a#ue to &e charged &! the current 'rom R< and #arge enough in*a#ue to ho#d pea+s whi#e discharging through resistors R5 and R .

(he negati*e pea+s o' the c#osed caption are transmitted at the same #e*e# as*ideo &#an+ing. "ith 4 restore this is A *o#ts. Resistors R5 and R sp#itthe di''erence &etween the posti*e pea+ he#d on 8 and ground to set thethresho#d 'or the data s#icing comparator FB< G centered &etween the pea+s o'the data *o#tage.

(he reco*ered c#osed caption data is input to the micro on -2A. (he data must&e on the 3S o' the port pin 'or the so'tware to read it as quic+#! and

Page 5: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 5/23

easi#! as possi&#e. (he so'tware reads the raw data stream 'rom () #ine 1into an arra! and then processes this arra! to 'ind the character codes in thecaption. (here are < samp#es o' raw data 'or each run%in c!c#e and a#so <samp#es per character data &it.

7ote: 2 A ?,D osci##ator wou#d a##ow more precise processing o' the *ideo toe tract the c#osed caption s!nc and data 'rom the *ideo. ?ore memor! isneeded Fmore than is a*ai#&#e in some - sG to sa*e the data samp#ed at thishigher rate.

RS% 0 dri*er%%%%%%%%%%%%%

(he RS% 0 dri*er is a poor manJs totem po#e output . (he dri*er isin*erting. "hen port pin - 1 is high I is he#d o''. "ith I o'' R1dri*es I0Js &ase to %< *o#ts causing I0Js emitter to 'o##ow to %0.0 *o#ts.4iode 4< is re*erse &iased. "hen - 1 is #ow I saturates at <.8 *o#ts and'orward &iases 4< to gi*e <.1 *o#ts on 4<Js cathode. R10 gi*es someprotection against re*ersed transmit/recei*e RS% 0 signa#s as we## as shortcircuits. (he so'tware sets seria# communications to <8AA aud 8 &its noparit! and 1 stop &it.

Optiona##! a RS% 0 input can &e used in p#ace o' some o' the 3E4Js andswitches. (he seria# input comes in through a series resistor FR$$ G used toprotect the input o' the micro. 2 pu## down resistor FR$$ G pre*ents theinput 'rom '#oating when the RS% 0 ca&#e is not connected. (he input 'or theseria# data uses the microJs interrupt pin F- AG so that no data 'rom thecomputer is #ost. Since the B2R( is done in so'tware howe*er the c#osedcaption decoding is suspended whi#e commands are &eing recei*ed. 2#so the3E4 that indicates acti*e c#osed captioning ma! &e rep#aced &! dri*ing theRS% 0 carrier detect #ine.

harge pump%%%%%%%%%%%

(he %< *o#ts is created &! a charge pump dri*en &! output pin - A. "hen - Ais high capacitor 9 is charged through 40 to C5 *o#ts on the - A side andCA. *o#ts on the other side. - A going #ow 'orces the #e't side o' 9 toground and there'or its right side to %<.< *o#ts. (his 'orward &iases diode4 and de#i*ers %0.8 *o#ts to charge 1A. (o maintain a constant 4 *o#tageon 1A - A must constant#! &e switching &etween the high and #ow states. (henegati*e < *o#t power supp#! must supp#! a&out 0ma ma imum. 1A must &e #argeenough in capacitance to maintain a ripp#e o' .1 *o#ts ma imum. (his requires- A to change at #east e*er! ms. (he program pumps the capacitors whene*erit is con*enient &ut ne*er goes more than one () 'ie#d with pumping caps 9and 1A. Bsua##! - A is pu#sed at a much 'aster rate. Lor instance e*er!time a &it is sent &! the B2R( code - A is pu#sed.

Some notes a&out the charge pump: 4iodes 4 and 40 are speci'ied as 17<<<8Jsto squeeDe a 'ew tenths o' a *o#t out o' the #osses in the charge pump. nmost cases more common 17<1<8 or 1791< t!pe diodes wi## wor+ 'ine. ' !ouwant e*en &etter negati*e dri*e *o#tage !ou can change 4 and 40 to 17581Schott+! recti'ier diodes to get a&out %<. *o#ts out o' the the charge pump'or the RS% 0 dri*er.

3E4Js and switches%%%%%%%%%%%%%%%%%%

(he switches use the interna# pu##up resistors o' the micro. (he switchinputs go #ow when the switch is pressed. (he 'unction o' the switches iscomp#ete#! under so'tware contro#. Switches S1 S and S0 are not used right

Page 6: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 6/23

now &ut wi## pro&a&#! &e used 'or se#ecting modes.

(he 3E4Js are on when the port pin is dri*en #ow. (he 3E4 current is ama imum o' 0ma. (his is su''icient 'or most #ighting conditions with a high&rightness 3E4. (he 'unction o' the 3E4s is comp#ete#! under so'twarecontro#. 3E4 45 Fon - <G is #it to indicate the presence o' c#osed caption onthe *ideo signa#. 2 -H( spea+er can a#so &e p#aced on - < to &eep at power ontime. (he other two 3E4s F4 and 4 G are used 'or de&ugging right now. 3E4s4 and 4 wi## pro&a&#! &e used as mode indicators.

7ote: ' #ines need to &e 'reed up on the micro the switches and 3E4Js caneasi#! share the same 0 pins. (his wou#d &e a good idea i' a - 1 isused.

(he micro%%%%%%%%%

(he micro runs at an osci##ator 'requenc! o' 1 ?,D. (his is =ust a #itt#e#ess than 0 times the 5A0 M,D run%in 'requenc! o' the c#osed caption signa#.

(he microprocessor is a ?icrochip - 1 8< in the protot!pe. (his part iseas! to program whi#e testing &ut is speci'ied to run at 1A ?hD ma imum not1 ?,D. 2t room temperature with t!pica# parts etc etc the part wor+s.(he part 'or the 'ina# use shou#d &e a - 1 1.

(he - 1 #oo+s #i+e it might wor+ e*en &etter since it has interna#*o#tage comparators. (he specJs 'or the *o#tage comparators are not rea#he#p'u# 'or determining i' the! wi## wor+. Eric intends to get samp#es o' the- 1 'or us to tr!... sometime. O' course the pin assignments ha*e tochange a &unch 'or the J to wor+.

(he so'tware%%%%%%%%%%%%

(he main #oop o' the program waits 'or a new *ideo 'ie#d counts s!nc pu#sesunti# #ine A does a 4 restore during horiDonta# &#an+ing c#amps the pea+detector waits 'or the s!nc pu#se that &egins #ine 1 de#a!s unti# theappro imate time o' the start o' run%in and re#eases the pea+ detectorc#amping.

2 1<%&!te data &u''er ca##ed samp#e is used to store up to 11 data samp#esduring #ine 1. (he routine getsamp is ca##ed to co##ect these samp#es.

t is written as a series o' in#ined pairs o' instructions #i+e this:rr' porta w N get 'irst &it o' samp#eCAr#' samp#eCA

(he 'irst instruction o' the pair is used to cop! the 3S o' port 2 Ftheoutput o' the data s#icing comparatorG to the carr! '#ag o' the statusregister. (he second instruction rotates the carr! into the 'irst &!te o'the samp#e &u''er. (his pair o' instructions is repeated eight times toacquire the 'irst eight samp#es. (here are 1< consecuti*e groups o' eightpairs and each group is identica# e cept that the o''set F CA G isincremented 'or each successi*e group.

2n a#ternati*e means o' samp#ing cou#d use a#ternating &it instructions ratherthan rotates:

&t'sc porta data&s' samp#eCA

! *irtue o' not using a rotate on the input port this a##ows the use o'an ar&itrar! &it rather than requiring the 3S and it wi## a##ow other &itso' the same port to &e used as outputs. (he on#! disad*antage is that itwou#d require the samp#e &u''er to &e c#eared in ad*ance.

Page 7: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 7/23

Page 8: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 8/23

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N cc.asmN op!right 199< 1995 Eric Smith Richard OttosenNN #osed aption 4ecoder using - 1 1 running at 1 ?,DN requires 3?1881 s!nc separator or equi*a#entNN cc.asm is 'ree so'twareN !ou can redistri&ute it and/or modi'! it under theN terms o' the ;7B ;enera# -u&#ic 3icense *ersion as pu&#ished &! the LreeN So'tware Loundation. 7ote that am not granting permission to redistri&uteN or modi'! dtm'.asm under the terms o' an! #ater *ersion o' the ;enera# -u&#icN 3icense.NN (his program is distri&uted in the hope that it wi## &e use'u# For at #eastN amusingG &ut " (,OB( 27K "2RR27(KN without e*en the imp#ied warrant! o'N ?ER ,27(2 3 (K or L (7ESS LOR 2 -2R( B32R -BR-OSE. See the ;7B ;enera#N -u&#ic 3icense 'or more detai#s.NN Kou shou#d ha*e recei*ed a cop! o' the ;7B ;enera# -u&#ic 3icense a#ong withN this program Fin the 'i#e O-K 7; GN i' not write to the Lree So'twareN Loundation nc. 5 ?ass 2*e am&ridge ?2 A 109 BS2.NN P,eader: /usr/home/+o#w!nia/eric/pic/cc/R S/cc.asm * 1.15 1995/A8/ 1 A1:A5:15eric E p eric PN%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

de*ice pic1 c 1 hsQosc wdtQo'' protectQo''

' equ 1 N 'or destination argumentw equ A N 'or destination argument

ind equ A N used 'or indirects thru 'srrtcc equ 1 N rea# time c#oc+/counterpc equ N program counter

status equ 0 N status register:c' equ A N &it A carr! &it '#agdc' equ 1 N &it 1 digit carr! &it '#agD' equ N &it Dero &it '#agpd' equ 0 N &it 0 power down &it '#agto' equ < N &it < time out &it '#agrsA equ 5 N &it 5 &an+ se#ect 'or pic1 c8<

N &its do not app#! to pic1 c8<

'sr equ < N 'i#e se#ect register Finde registerG

N ascii *a#ues&e# equ A h N &e##&s equ A8h N &ac+ spaceta& equ A9h N horiDonta# ta&#' equ Aah N #ine 'eed'' equ Ach N 'orm 'eedcr equ Adh N carriage return

on equ 11h N transmit ono'' equ 10h N transmit o''

eo' equ 1ah N end o' 'i#eesc equ 1&h N escapesp equ Ah N space

porta equ 5 N i/o port a:data equ A N &it A data input-ea+ equ 1 N &it 1 2cti*e #ow reset 'or pea+ detect

Page 9: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 9/23

N FOccurs during #ine 1GRestore equ N &it ac+ porch 4 restore pu#secs!nc equ 0 N &it 0 composite s!nc input 'rom s!nc

N stripper Facti*e #owG

N it < input Ftied to groundG

N this does not wor+ with N &it < is tied to &it 0 in order toa##owN - 1 1 ha*ing -2< &ug N R( to count s!nc pu#ses

port& equ N i/o port &:-ump equ A N &it A harge pump dri*e 'or RS 0 %< )o#tst d equ 1 N &it rs 0 seria# data output#ed1 equ N &it #ed de&ug:#ed equ 0 N &it 0 #ed de&ug: 'ie#d signa##ed0 equ < N &it < 2cti*e caption 3E4pDt equ < N &it < pDt spea+er output&uttonA equ 5 N &it 5 ne t mode &utton input&utton1 equ N &it ne t mode &utton input&utton equ N &it ne t mode &utton input

N Facti*e #owG

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N ramN%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

ram&ase equ Ach N start o' ram

org ram&ase

count ds 1 N genera# purpose counterd#!cnt ds 1 N counter 'or de#a!s Fused in se*era# p#acesGmscnt ds 1 N num&er o' mi##iseconds using de#a! routinec!c#es ds 1 N num&er o' c!c#es in a &eepperiod ds 1 N period o' a c#ic+

temp ds 1 N *er! temporar! storagetemp ds 1

serreg ds 1 N seria# output character &u''er&itcnt ds 1 N seria# output &it countspeed ds 1 N seria# speed

m'#ags ds 1 N misc. '#ags#aD!cr equ A N &it A #aD! cr pending#ast&it equ 1 N &it 1 #ast &it Fused in gets&itG'ie#d equ N &it odd 'ie#d

sid 8 ds 1sid 1 ds 1trcnt ds 1

samp#e ds 1< N 11 samp#es at ?,D.N #osed caption is =ust under 1A< samp#es #ong.N E tra 8 samp#es a##ow some s#op 'or de#a! toN start o' run%in.

odata ds

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N reset and interrupt *ectors

Page 10: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 10/23

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

org A

goto resetnopnopnopgoto reset N interrupts not used

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N uti#itiesN%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

N de#a! 'or w 1ms at <mhD osc. 'req.de#a! mo*w' mscnt N count mi##isecondsd#!1A mo*#w 5A

mo*w' d#!cntd#! A dec' d#!cnt N 1 c!c#e

&t'ss status D' N 1goto d#! A N < c!c#esdec'sD mscnt N #ast msec$goto d#!1Areturn

N ma+e a &e## sound&eep mo*#w AA

mo*w' c!c#esmo*#w 5< N a nice tone$$$mo*w' period N F'a## into c#ic+ G

N ma+e a c#ic+ sound c!c#es num&er o' times.N 'requenc! 1 /F1 /Fosc 'requenc! /<G 5 c!c#es period Gc#ic+ &s' port& pDt N c#ic+ high

mo*' period w N time 'or one ha#' o' c!c#emo*w' d#!cnt N into de#a! counter

c#+1A goto c#+15 N F&urn c!c#esG c!c#esc#+15 dec'sD d#!cnt N 1

goto c#+1A N 5 c!c#es&c' port& pDt N c#ic+ #owmo*' period w N time 'or one ha#' o' c!c#emo*w' d#!cnt N into de#a! counter

c#+ A goto c#+ 5 N F&urn c!c#esG c!c#esc#+ 5 dec'sD d#!cnt N 1

goto c#+ A N 5 c!c#es

dec'sD c!c#es N another c!c#e o' c#ic+$goto c#ic+ N &ranch i' soreturn

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N output a &!te in &inar!N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

out&&: mo*w' tempmo*#w 8mo*w' temp

out&&1: mo*#w JAJ&t'sc tempadd#w 1

Page 11: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 11/23

ca## mit

r#' tempdec'sD tempgoto out&&1return

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N output a &!te in he adecima#N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

outh&: mo*w' tempswap' temp wca## outhdmo*' temp w

N 'a## into outhd

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N output a he digitN%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

outhd: and#w A'hadd#w A' h&t'sc status c'add#w A hadd#w 0ah

N 'a## into mit

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N seria# outputN%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

N(ransmit character in "%Reg as 8 &its no parit! 1 stop.N (his routine has the start stop and data &its non%in*erted &ecause anN in*erting RS% 0 &u''er is used.

mit L -ort -ump N -ump some charge into negati*e < )o#t supp#!mo*w' serreg N sa*e charactermo*#w 1A N put T o' data &its C start &it C T stop &itsmo*w' &itcnt N into counter&s' status c' N set up the stop &it&c' port& t d N send start &it

mt1A mo*' speed w N de#a! 1 &it timemo*w' d#!cnt

SL -ort -ump N -ump some charge into negati*e < )o#t supp#!d1 nop N 1 c!c#e

dec'sD d#!cnt N 1goto d1 N < c!c#es

L -ort -ump N -ump some charge into negati*e < )o#t supp#!Nnop N ma+e sure o*erhead is an e*en mu#tip#e o'Nnop N d1 #oop time. 1 c!c#es in this case.

N Fno ad=ustment needed with charge pumpingG.dec' &itcnt N count the data &its&t'sc status D'goto mt0A N and e it when donerr' serreg N get data &it into carr!&t'sc status c' N i' carr! is set&s' port& t d N then mit a Dero&t'ss status c' N i' carr! is c#ear&c' port& t d N then transmit a onegoto mt1A

Page 12: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 12/23

mt0A SL -ort -ump N -ump some charge into negati*e < )o#t supp#!return N end o' mit

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N initia#iDe the hardwareN%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

inithw:c#rwdt N reset watchdog timermo*#w A8h N e terna# edge to timeroption N high to #ow edge 'or timer

N presca#er assigned to watchdogN presca#er di*ide &! 1 8 'or now

RestOn EIB AL h N -ort2 with the 4 Restore c#amp on-ea+On EIB AL4h N -ort2 with the -ea+ detect reset on

#ampsO'' EIB ALLh N -ort2 with &oth -ea+ reset and Restore c#ampN o'' and not c#amping.

?O)3" #ampsO'' N -ort2 &its A and 0 are inputstris porta

L -ort2 Restore N Bse &oth these pins as open co##ector outputsL -ort2 -ea+

?O)3" AEAh N -ort &its A through < are outputstris port&

c#r' port& N A *o#ts on spea+er

mo*#w A8%< N <8AA &ps w/ 1 .AAA ?,D cr!sta#mo*w' speed

return

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N get data samp#es 'or the 'u## scan #ineN%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

getsamp:rr' porta w N get 'irst &it o' samp#eCAr#' samp#eCArr' porta w N get second &it o' samp#eCAr#' samp#eCArr' porta w N get third &it o' samp#eCAr#' samp#eCArr' porta w N get 'ourth &it o' samp#eCAr#' samp#eCArr' porta w N get 'i'th &it o' samp#eCAr#' samp#eCArr' porta w N get si th &it o' samp#eCAr#' samp#eCArr' porta w N get se*enth &it o' samp#eCAr#' samp#eCArr' porta w N get eighth &it o' samp#eCAr#' samp#eCA

rr' porta w N get 'irst &it o' samp#eC1r#' samp#eC1rr' porta w N get second &it o' samp#eC1r#' samp#eC1rr' porta w N get third &it o' samp#eC1

Page 13: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 13/23

r#' samp#eC1rr' porta w N get 'ourth &it o' samp#eC1r#' samp#eC1rr' porta w N get 'i'th &it o' samp#eC1r#' samp#eC1rr' porta w N get si th &it o' samp#eC1r#' samp#eC1rr' porta w N get se*enth &it o' samp#eC1r#' samp#eC1rr' porta w N get eighth &it o' samp#eC1r#' samp#eC1

rr' porta w N get 'irst &it o' samp#eCr#' samp#eCrr' porta w N get second &it o' samp#eCr#' samp#eCrr' porta w N get third &it o' samp#eCr#' samp#eCrr' porta w N get 'ourth &it o' samp#eCr#' samp#eCrr' porta w N get 'i'th &it o' samp#eCr#' samp#eCrr' porta w N get si th &it o' samp#eCr#' samp#eCrr' porta w N get se*enth &it o' samp#eCr#' samp#eCrr' porta w N get eighth &it o' samp#eCr#' samp#eC

rr' porta w N get 'irst &it o' samp#eC0r#' samp#eC0rr' porta w N get second &it o' samp#eC0r#' samp#eC0rr' porta w N get third &it o' samp#eC0r#' samp#eC0rr' porta w N get 'ourth &it o' samp#eC0r#' samp#eC0rr' porta w N get 'i'th &it o' samp#eC0r#' samp#eC0rr' porta w N get si th &it o' samp#eC0r#' samp#eC0rr' porta w N get se*enth &it o' samp#eC0r#' samp#eC0rr' porta w N get eighth &it o' samp#eC0r#' samp#eC0

rr' porta w N get 'irst &it o' samp#eC<r#' samp#eC<rr' porta w N get second &it o' samp#eC<r#' samp#eC<rr' porta w N get third &it o' samp#eC<r#' samp#eC<rr' porta w N get 'ourth &it o' samp#eC<r#' samp#eC<rr' porta w N get 'i'th &it o' samp#eC<r#' samp#eC<rr' porta w N get si th &it o' samp#eC<r#' samp#eC<rr' porta w N get se*enth &it o' samp#eC<r#' samp#eC<rr' porta w N get eighth &it o' samp#eC<r#' samp#eC<

rr' porta w N get 'irst &it o' samp#eC5

Page 14: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 14/23

r#' samp#eC5rr' porta w N get second &it o' samp#eC5r#' samp#eC5rr' porta w N get third &it o' samp#eC5r#' samp#eC5rr' porta w N get 'ourth &it o' samp#eC5r#' samp#eC5rr' porta w N get 'i'th &it o' samp#eC5r#' samp#eC5rr' porta w N get si th &it o' samp#eC5r#' samp#eC5rr' porta w N get se*enth &it o' samp#eC5r#' samp#eC5rr' porta w N get eighth &it o' samp#eC5r#' samp#eC5

rr' porta w N get 'irst &it o' samp#eCr#' samp#eCrr' porta w N get second &it o' samp#eCr#' samp#eCrr' porta w N get third &it o' samp#eCr#' samp#eCrr' porta w N get 'ourth &it o' samp#eCr#' samp#eCrr' porta w N get 'i'th &it o' samp#eCr#' samp#eCrr' porta w N get si th &it o' samp#eCr#' samp#eCrr' porta w N get se*enth &it o' samp#eCr#' samp#eCrr' porta w N get eighth &it o' samp#eCr#' samp#eC

rr' porta w N get 'irst &it o' samp#eCr#' samp#eCrr' porta w N get second &it o' samp#eCr#' samp#eCrr' porta w N get third &it o' samp#eCr#' samp#eCrr' porta w N get 'ourth &it o' samp#eCr#' samp#eCrr' porta w N get 'i'th &it o' samp#eCr#' samp#eCrr' porta w N get si th &it o' samp#eCr#' samp#eCrr' porta w N get se*enth &it o' samp#eCr#' samp#eCrr' porta w N get eighth &it o' samp#eCr#' samp#eC

rr' porta w N get 'irst &it o' samp#eC8r#' samp#eC8rr' porta w N get second &it o' samp#eC8r#' samp#eC8rr' porta w N get third &it o' samp#eC8r#' samp#eC8rr' porta w N get 'ourth &it o' samp#eC8r#' samp#eC8rr' porta w N get 'i'th &it o' samp#eC8r#' samp#eC8rr' porta w N get si th &it o' samp#eC8r#' samp#eC8rr' porta w N get se*enth &it o' samp#eC8r#' samp#eC8

Page 15: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 15/23

rr' porta w N get eighth &it o' samp#eC8r#' samp#eC8

rr' porta w N get 'irst &it o' samp#eC9r#' samp#eC9rr' porta w N get second &it o' samp#eC9r#' samp#eC9rr' porta w N get third &it o' samp#eC9r#' samp#eC9rr' porta w N get 'ourth &it o' samp#eC9r#' samp#eC9rr' porta w N get 'i'th &it o' samp#eC9r#' samp#eC9rr' porta w N get si th &it o' samp#eC9r#' samp#eC9rr' porta w N get se*enth &it o' samp#eC9r#' samp#eC9rr' porta w N get eighth &it o' samp#eC9r#' samp#eC9

rr' porta w N get 'irst &it o' samp#eC1Ar#' samp#eC1Arr' porta w N get second &it o' samp#eC1Ar#' samp#eC1Arr' porta w N get third &it o' samp#eC1Ar#' samp#eC1Arr' porta w N get 'ourth &it o' samp#eC1Ar#' samp#eC1Arr' porta w N get 'i'th &it o' samp#eC1Ar#' samp#eC1Arr' porta w N get si th &it o' samp#eC1Ar#' samp#eC1Arr' porta w N get se*enth &it o' samp#eC1Ar#' samp#eC1Arr' porta w N get eighth &it o' samp#eC1Ar#' samp#eC1A

rr' porta w N get 'irst &it o' samp#eC11r#' samp#eC11rr' porta w N get second &it o' samp#eC11r#' samp#eC11rr' porta w N get third &it o' samp#eC11r#' samp#eC11rr' porta w N get 'ourth &it o' samp#eC11r#' samp#eC11rr' porta w N get 'i'th &it o' samp#eC11r#' samp#eC11rr' porta w N get si th &it o' samp#eC11r#' samp#eC11rr' porta w N get se*enth &it o' samp#eC11r#' samp#eC11rr' porta w N get eighth &it o' samp#eC11r#' samp#eC11

rr' porta w N get 'irst &it o' samp#eC1r#' samp#eC1rr' porta w N get second &it o' samp#eC1r#' samp#eC1rr' porta w N get third &it o' samp#eC1r#' samp#eC1rr' porta w N get 'ourth &it o' samp#eC1r#' samp#eC1rr' porta w N get 'i'th &it o' samp#eC1r#' samp#eC1

Page 16: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 16/23

rr' porta w N get si th &it o' samp#eC1r#' samp#eC1rr' porta w N get se*enth &it o' samp#eC1r#' samp#eC1rr' porta w N get eighth &it o' samp#eC1r#' samp#eC1

rr' porta w N get 'irst &it o' samp#eC10r#' samp#eC10rr' porta w N get second &it o' samp#eC10r#' samp#eC10rr' porta w N get third &it o' samp#eC10r#' samp#eC10rr' porta w N get 'ourth &it o' samp#eC10r#' samp#eC10rr' porta w N get 'i'th &it o' samp#eC10r#' samp#eC10rr' porta w N get si th &it o' samp#eC10r#' samp#eC10rr' porta w N get se*enth &it o' samp#eC10r#' samp#eC10rr' porta w N get eighth &it o' samp#eC10r#' samp#eC10

return

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N get a sing#e samp#e &it 'rom the samp#e &u''erN return it in the '#agN return with H '#ag set i' out o' &itsN%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

gets&it:&c' status c' N ad*ance &it positionrr' sid 1&t'ss status c'goto gets&mo*#w 8Ahmo*w' sid 1inc' sid 8

mo*' sid 8 w N test 'or end o' &u''eror#w samp#eC1<

&t'ss status D'goto gets&

&s' status D' N out o' &itsreturn

gets& :mo*' sid 8 wmo*w' 'srmo*' ind wandw' sid 1 w

N po#arit! o' raw samp#e data is in*erted so Dero '#ag ends up true

&t'sc status D'goto gets&1

&t'sc m'#ags #ast&it N got a Dero &it increment trcnt i' #ast&itinc' trcnt N was a one

&c' m'#ags #ast&it

Page 17: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 17/23

&c' status c'&c' status D'return

gets&1:&t'ss m'#ags #ast&it N got a one &it increment trcnt i' #ast&itinc' trcnt N was a Dero&s' m'#ags #ast&it&s' status c'&c' status D'return

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N chec+ parit!N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

parit!:mo*w' tempmo*#w 8mo*w' &itcntc#rw

par1: orw' temp wrr' tempdec'sD &itcntgoto par1and#w A1hreturn

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N output one character as ascii or as in he adecima# as 6 i' unprinta&#eN%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

aout:and#w A 'h N strip parit! FsighGmo*w' temp

mo*' temp N donJt output nu##s&t'sc status D'return

add#w AeAh N *a#ues 'rom AA to 1' show he&t'ss status c'goto aouth

mo*' temp w N ' show heor#w A 'h

&t'sc status D'goto aouth

mo*' temp wgoto mit

aouth: mo*#w J6Jca## mit

mo*' temp wca## outh&

mo*#w J Jgoto mit

Page 18: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 18/23

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N process the raw samp#esN%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

process:L -ort -ump N -ump some charge into negati*e < )o#t supp#!

&s' port& #ed0 N assume the worst

c#r' odatac#r' odataC1

mo*#w samp#e%1mo*w' sid 8mo*#w A1hmo*w' sid 1

c#r' trcnt N transition counter&c' m'#ags #ast&it

N Lind start o' run%in"a#+Bp: ca## gets&it

&t'sc status c' N Lirst samp#e must &e a A i' c#osed captionreturn

mo*#w N 3imit how 'ar we #oo+mo*w' &itcnt

"B1A ca## gets&it&t'sc status c'goto pone N Lound the 'irst one &it o' the run%indec'sD &itcntgoto "B1Areturn N Run%in not 'ound... no c#osed caption

N #oo+ 'or the gap &etween the #eadin and the start &it

pone: mo*#w N count down Dero &itsmo*w' &itcnt

pDero: ca## gets&it&t'sc status D'goto errnoA N ran out o' &its&t'sc status c'goto pone N darn itJs a one start counting a## o*erdec'sD &itcntgoto pDero

SL -ort -ump N -ump some charge into negati*e < )o#t supp#!

N now 'ind a one &it

'one: ca## gets&it&t'sc status D'goto errno1 N ran out o' &its&t'ss status c'goto 'one N darn itJs a Dero #oo+ some more

L -ort -ump N -ump some charge into negati*e < )o#t supp#!

N PPP 4E B; % output transition countN mo*' trcnt wN ca## outh&N mo*#w J JN goto mit

N test the transition counter to ma+e sure #eadin was present

Page 19: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 19/23

tmin equ 1A%1 N de&ug to a##ow 'or s#ow comparator F3?090GN tmin equ 1<tma equ 1 %1

mo*' trcnt wadd#w 5 %tminadd#w 55Ctmin%tma&t'sc status c'return

&c' port& #ed0 N indicate *a#id #eadin and start &it 'ound

ca## gets&it N s+ip the second and third samp#es&t'sc status D' N o' the start &itgoto too'ew&itsca## gets&it&t'sc status D'goto too'ew&its

mo*#w 1mo*w' &itcnt

p#: ca## gets&it N s+ip three samp#es and get 'ourth&t'sc status D'goto too'ew&itsca## gets&it&t'sc status D'goto too'ew&itsca## gets&it&t'sc status D'goto too'ew&itsca## gets&it&t'sc status D'goto too'ew&its

rr' odataC1rr' odata

dec'sD &itcntgoto p#

mo*' odata w N chec+ parit! o' 'irst &!teca## parit!&t'sc status D'goto perror

mo*' odata wca## parit!&t'sc status D'goto perror

mo*' odata w N strip parit! 'rom 'irst &!teand#w 'hmo*w' odata

mo*' odataC1 w N strip parit! 'rom second &!teand#w 'hmo*w' odataC1

mo*' odata w N i' the 'irst &!te is U Ah hand#eadd#w AeAh N it norma##!&t'sc status c'goto p8

Page 20: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 20/23

mo*' odata w N i' the 'irst &!te isnJt 1<h throw itor#w A1<h N awa!

&t'ss status D'return

mo*' odataC1 w N i' the second &!te isnJt dh throw itor#w A dh N awa!

&t'ss status D'return

&s' m'#ags #aD!cr N remem&er to do a VcrU #aterreturn

p8:&t'ss m'#ags #aD!crgoto p9&c' m'#ags #aD!cr

mo*#w crca## mitmo*#w #'ca## mit

p9:mo*' odata wca## aoutmo*' odataC1 wca## aoutreturn

too'ew&its:mo*#w J Jgoto error

errnoA:mo*#w JAJgoto error

errno1:mo*#w J1Jgoto error

perror:mo*#w J-J

error:mo*w' tempmo*#w J6Jca## mitmo*' temp wca## mitmo*#w J Jca## mitreturn

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N program entr! pointN%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

reset: ca## inithw N initia#iDe hardwareca## &eep N indicate specia# mode

c#r' m'#ags N c#ear the misc. '#ags

Page 21: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 21/23

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N main #oopN%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

main:ca## waiteq N wait 'or a 'ie#d

mo*#w N wait 'or #ine Amo*w' temp

wait 1:NS!nc up to do 4 restorewn1 &t'ss porta cs!nc N i' weJre a#read! in a s!nc pu#se

goto wn1 N we ha*e to wait 'or the ne t oneSL -ort -ump N -ump some charge into negati*e < )o#t supp#!

ws1: &t'sc porta cs!nc N wait 'or start o' s!nc pu#segoto ws1

L -ort -ump N -ump some charge into negati*e < )o#t supp#!

mo*#w 5 N de#a! to end o' hs!nc pu#sehd1: add#w A''h

&t'ss status D'goto hd1

L -ort2 Restore N ?a+e sure output is sti## #ow?O)3" RestOn N #amp *ideo 'or 4 restoretris porta N -u#se uS in center o' &#an+ing7O-7O-7O-7O-7O-

SL -ort -ump N -ump some charge into negati*e < )o#t supp#!?O)3" #ampsO'' N (urn the 4 restore c#amp o''tris portadec'sD tempgoto wait 1

&t'ss m'#ags 'ie#d N i' itJs not an odd 'ie#d tr! againgoto main

L -ort2 -ea+ N ?a+e sure output is sti## #ow?O)3" -ea+On N Reset pea+ detectortris porta

N Re%s!nc 'or accurate start o' #ine 1ws : &t'sc porta cs!nc N wait 'or start o' s!nc pu#se

goto wsL -ort -ump N -ump some charge into negati*e < )o#t supp#!

mo*#w N de#a! uS to get within samp#es o'hd add#w A''h N &egining o' start o' run%in

&t'ss status D'goto hd7O-7O-7O-

?O)3" #ampsO'' N Re#ease pea+ detect c#amptris porta

Page 22: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 22/23

SL port& #ed1 N de&ugca## getsamp

L port& #ed1 N de&ugca## process

SL -ort -ump N -ump some charge into negati*e < )o#t supp#!

goto main

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N s!nc separator that mimics the #m1881 #ogic Fat 1 mhD osci##ator 'requenc!G.N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

N wait 'or the equi#iDing pu#ses

waiteq mo*#w 1A N i' s!nc is acti*e 'or more than 1 us or somo*w' temp N then it is a serrated *ertica# pu#se

weAA &t'ss porta cs!nc N wait 'or s!nc to &e inacti*egoto weAA

SL -ort -ump N -ump some charge into negati*e < )o#t supp#!

weA &t'sc porta cs!nc N wait 'or s!nc to &e acti*egoto weA

L -ort -ump N -ump some charge into negati*e < )o#t supp#!

weA5 &t'sc porta cs!nc N is s!nc inacti*e !et$goto we1A N !es it must rea##! &e an hs!nc or equa#.dec'sD temp N has it &een too #ong$goto weA5 N no +eep watching itgoto waiteq N must &e a serrated *ertica# pu#se start o*er

we1A SL -ort -ump N -ump some charge into negati*e < )o#t supp#!mo*#w 08 N time 'or more than ha#' o' a #inemo*w' temp N Fa&out < us / 5Ans 188 c!c#esG

we A &t'ss porta cs!nc N s!nc acti*e$goto we0A N !es 'ound an equa#iDing pu#se Adec'sD temp N no out o' time$ 1goto we A N no +eep watching 'or it 5goto weA N itJs more than ha#' a #ine tr! again

we0A &t'ss porta cs!nc N wait 'or s!nc to &e inacti*egoto we0A

N weJ*e now 'ound either the second equa#iDing pu#se o' an odd 'ie#d or theN 'irst equa#iDing pu#se o' an e*en 'ie#d &ut we donJt !et +now which.

N 'a## into code to separate the *ertica# s!nc

N%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%N separate the *ertica# s!nc and determine which 'ie#d weJre inN%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

c#r' countmo*#w 1 N time 'or ha#' o' a wide equa#iDing spacemo*w' temp N Fa&out 1 us / 5Ans < c!c#esG

s*1A &t'sc porta cs!nc N wait 'or s!nc to &e acti*egoto s*1A

L -ort -ump N -ump some charge into negati*e < )o#t supp#!

N now measure the width o' the pu#se

Page 23: Decodificador Closed Caption

8/12/2019 Decodificador Closed Caption

http://slidepdf.com/reader/full/decodificador-closed-caption 23/23

inc' count

s* A &t'sc porta cs!nc N s!nc sti## acti*e$ c!c#egoto s*1A N no it was an equa#iDing pu#se Adec'sD temp N !es has it &een wide enough$ 1goto s* A N no +eep watching it 5

N now weJ*e gotten a wide F*ertica#G s!nc pu#se

s*0A &t'ss porta cs!nc N wait 'or s!nc to go inacti*egoto s*0A

SL -ort -ump N -ump some charge into negati*e < )o#t supp#!

N the count o' equa#iDing pu#ses preceding the 'irst *etica# s!nc pu#seN determines whether it is an e*en or odd 'ie#d

&c' m'#ags 'ie#d&t'sc count A N cop! temp #s& as odd/e*en 'ie#d&s' m'#ags 'ie#d

N de&ug&t'sc count A NLie#d signa#&s' port& #ed&t'ss count A&c' port& #ed

return N return with s!nc inacti*e

end