<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<head>
<style>.content {
padding: 20px;
height: 100%;
width: 944px;
margin-left: auto;
margin-right: auto;
}
.fold {
width: 20px;
float: left;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.number {
width: 45px;
float: left;
margin-right: 10px;
text-align: right;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.line {
}
.content {
font-family: "Monospace";
font-size: 1em;
background: #3f3f3f;
color: White;
width: 944px;
padding: 20px;
height: 100%;
margin-left: auto;
margin-right: auto;
}
font.Alert {
color: Yellow;
font-weight: bold;
}
font.Annotation {
color: Yellow;
font-style: italic;
}
font.Attribute {
color: LightPink;
}
font.BaseN {
color: Gold;
}
font.BuiltIn {
color: Coral;
}
font.Char {
color: Cyan;
}
font.Comment {
color: Beige;
font-style: italic;
}
font.CommentVar {
color: LightBlue;
font-style: italic;
}
font.Constant {
color: White;
font-weight: bold;
}
font.ControlFlow {
color: DeepPink;
}
font.DataType {
color: CadetBlue;
}
font.DecVal {
color: MediumPurple;
font-weight: bold;
}
font.Documentation {
color: Gold;
font-style: italic;
}
font.Error {
color: Red;
font-weight: bold;
}
font.Extension {
color: DarkGray;
font-weight: bold;
}
font.Float {
color: DarkViolet;
font-weight: bold;
}
font.Function {
color: RosyBrown;
}
font.Import {
color: PaleVioletRed;
}
font.Information {
color: LightGreen;
font-style: italic;
}
font.Keyword {
color: LightGreen;
font-weight: bold;
}
font.Normal {
color: White;
}
font.Operator {
color: Magenta;
}
font.Others {
color: GreenYellow;
}
font.Preprocessor {
color: DarkSeaGreen ;
font-weight: bold;
}
font.RegionMarker {
color: Plum;
}
font.SpecialChar {
color: Plum;
font-weight: bold;
}
font.SpecialString {
color: LightBlue;
}
font.String {
color: MediumAquaMarine;
}
font.Variable {
color: Turquoise;
font-weight: bold;
}
font.VerbatimString {
color: LightSkyBlue;
}
font.Warning {
color: Brown;
font-weight: bold;
}
</style>
<title>Kamelon output</title>
</head>
<body>
<div class="content">
<div id="1" class="line"><font class="Comment">;</font></br></div>
<div id="2" class="line"><font class="Comment">; Decodeur de trame pulsadis EJP et préavis EJP</font></br></div>
<div id="3" class="line"><font class="Comment">; (pic 12C508 ou 509)</font></br></div>
<div id="4" class="line"><font class="Comment">; Alain Gibaud, 20-2-2001</font></br></div>
<div id="5" class="line"><font class="Comment">;</font></br></div>
<div id="6" class="line"><font class="Comment">; ========================================================</font></br></div>
<div id="7" class="line"><font class="Normal"> list r=hex,p=p12c508</font></br></div>
<div id="8" class="line"></br></div>
<div id="9" class="line"><font class="Normal"> include </font><font class="String">"p12c508.inc"</font></br></div>
<div id="10" class="line"><font class="Normal">GP0 equ </font><font class="DecVal">0</font></br></div>
<div id="11" class="line"><font class="Normal">GP1 equ </font><font class="DecVal">1</font></br></div>
<div id="12" class="line"><font class="Normal">GP2 equ </font><font class="DecVal">2</font></br></div>
<div id="13" class="line"><font class="Normal">GP3 equ </font><font class="DecVal">3</font></br></div>
<div id="14" class="line"><font class="Normal">GP4 equ </font><font class="DecVal">4</font></br></div>
<div id="15" class="line"><font class="Normal">GP5 equ </font><font class="DecVal">5</font></br></div>
<div id="16" class="line"><font class="Normal">TO equ </font><font class="DecVal">4</font><font class="Normal"> </font></br></div>
<div id="17" class="line"><font class="Comment">; masques pour acceder aux pattes</font></br></div>
<div id="18" class="line"><font class="Normal">GP0bit equ </font><font class="DecVal">1</font><font class="Normal"> << GP0</font></br></div>
<div id="19" class="line"><font class="Normal">GP1bit equ </font><font class="DecVal">1</font><font class="Normal"> << GP1</font></br></div>
<div id="20" class="line"><font class="Normal">GP2bit equ </font><font class="DecVal">1</font><font class="Normal"> << GP2</font></br></div>
<div id="21" class="line"><font class="Normal">GP3bit equ </font><font class="DecVal">1</font><font class="Normal"> << GP3</font></br></div>
<div id="22" class="line"><font class="Normal">GP4bit equ </font><font class="DecVal">1</font><font class="Normal"> << GP4 </font></br></div>
<div id="23" class="line"><font class="Normal">GP5bit equ </font><font class="DecVal">1</font><font class="Normal"> << GP5 </font></br></div>
<div id="24" class="line"><font class="Comment">; ========================================================</font></br></div>
<div id="25" class="line"><font class="Comment">; affectation des pattes</font></br></div>
<div id="26" class="line"><font class="Comment">; </font></br></div>
<div id="27" class="line"></br></div>
<div id="28" class="line"><font class="Comment">; sorties: (actives niv bas)</font></br></div>
<div id="29" class="line"><font class="Normal">NORMAL equ GP0 </font><font class="Comment">; LED verte</font></br></div>
<div id="30" class="line"><font class="Normal">ALERTE equ GP1 </font><font class="Comment">; LED orange</font></br></div>
<div id="31" class="line"><font class="Normal">EJP equ GP2 </font><font class="Comment">; LED rouge</font></br></div>
<div id="32" class="line"><font class="Comment">; entrees:( actives niv bas)</font></br></div>
<div id="33" class="line"><font class="Normal">SIGNAL equ GP3 </font><font class="Comment">; avec pull-up, en provenance filtre 175 Hz</font></br></div>
<div id="34" class="line"><font class="Comment">; GP4-5 sont utilisees par l'horloge</font></br></div>
<div id="35" class="line"><font class="Comment">; ========================================================</font></br></div>
<div id="36" class="line"><font class="Comment">; variables:</font></br></div>
<div id="37" class="line"><font class="Normal">TICKS equ </font><font class="BaseN">0x7</font><font class="Normal"> </font><font class="Comment">; compteur de ticks (1 tick = 2/100 s)</font></br></div>
<div id="38" class="line"><font class="Normal">SLOT equ </font><font class="BaseN">0x8</font><font class="Normal"> </font><font class="Comment">; numero slot dans la trame </font></br></div>
<div id="39" class="line"><font class="Comment">; =======================================================</font></br></div>
<div id="40" class="line"><font class="Comment">; Macros pour alleger le code ...</font></br></div>
<div id="41" class="line"><font class="Comment">;</font></br></div>
<div id="42" class="line"><font class="Comment">; Teste si min <= (var) < max</font></br></div>
<div id="43" class="line"><font class="Comment">; branche en "in" si oui, en "out" si non.</font></br></div>
<div id="44" class="line"><font class="Comment">; </font></br></div>
<div id="45" class="line"><font class="Normal">Lminmax macro var,min,max,outm,</font><font class="Keyword">in</font><font class="Normal">,outp</font></br></div>
<div id="46" class="line"><font class="Normal"> movlw min</font></br></div>
<div id="47" class="line"><font class="Normal"> subwf var,W </font><font class="Comment">; (var) - min</font></br></div>
<div id="48" class="line"><font class="Normal"> btfss STATUS,C</font></br></div>
<div id="49" class="line"><font class="Normal"> goto outm </font><font class="Comment">; C=0 => resutat < 0 => var < min</font></br></div>
<div id="50" class="line"><font class="Normal"> </font></br></div>
<div id="51" class="line"><font class="Normal"> movlw max</font></br></div>
<div id="52" class="line"><font class="Normal"> subwf var,W </font><font class="Comment">; (var) - max</font></br></div>
<div id="53" class="line"><font class="Normal"> btfss STATUS,C</font></br></div>
<div id="54" class="line"><font class="Normal"> goto </font><font class="Keyword">in</font></br></div>
<div id="55" class="line"><font class="Normal"> goto outp </font><font class="Comment">; C=1 => resutat >= 0 => var >= min</font></br></div>
<div id="56" class="line"><font class="Normal"> endm</font></br></div>
<div id="57" class="line"><font class="Comment">;</font></br></div>
<div id="58" class="line"><font class="Comment">; Attend que le bit "bit" du registre "reg" soit a 1</font></br></div>
<div id="59" class="line"><font class="Comment">;</font></br></div>
<div id="60" class="line"><font class="Normal">Waitbit1 macro reg,bit</font></br></div>
<div id="61" class="line"><font class="Normal"> local Wait1</font></br></div>
<div id="62" class="line"><font class="Normal">Wait1 btfss reg,bit</font></br></div>
<div id="63" class="line"><font class="Normal"> goto Wait1</font></br></div>
<div id="64" class="line"><font class="Normal"> endm</font></br></div>
<div id="65" class="line"><font class="Comment">;</font></br></div>
<div id="66" class="line"><font class="Comment">; Attend que le bit "bit" du registre "reg" soit a 0</font></br></div>
<div id="67" class="line"><font class="Comment">;</font></br></div>
<div id="68" class="line"><font class="Normal">Waitbit0 macro reg,bit</font></br></div>
<div id="69" class="line"><font class="Normal"> local Wait0</font></br></div>
<div id="70" class="line"><font class="Normal">Wait0 btfsc reg,bit</font></br></div>
<div id="71" class="line"><font class="Normal"> goto Wait0</font></br></div>
<div id="72" class="line"><font class="Normal"> endm</font></br></div>
<div id="73" class="line"><font class="Comment">;</font></br></div>
<div id="74" class="line"><font class="Comment">; Branche en "label" si (reg) == num, sinon continue</font></br></div>
<div id="75" class="line"><font class="Comment">;</font></br></div>
<div id="76" class="line"><font class="Normal">Beq macro label,reg,num</font></br></div>
<div id="77" class="line"><font class="Normal"> movlw num</font></br></div>
<div id="78" class="line"><font class="Normal"> subwf reg,W</font></br></div>
<div id="79" class="line"><font class="Normal"> btfsc STATUS,Z </font></br></div>
<div id="80" class="line"><font class="Normal"> goto label</font></br></div>
<div id="81" class="line"><font class="Normal"> endm</font></br></div>
<div id="82" class="line"><font class="Comment">;</font></br></div>
<div id="83" class="line"><font class="Comment">; Branche en "label" si (reg) != num, sinon continue</font></br></div>
<div id="84" class="line"><font class="Comment">;</font></br></div>
<div id="85" class="line"><font class="Normal">Bne macro label,reg,num</font></br></div>
<div id="86" class="line"><font class="Normal"> movlw num</font></br></div>
<div id="87" class="line"><font class="Normal"> subwf reg,W</font></br></div>
<div id="88" class="line"><font class="Normal"> btfss STATUS,Z </font></br></div>
<div id="89" class="line"><font class="Normal"> goto label</font></br></div>
<div id="90" class="line"><font class="Normal"> endm </font></br></div>
<div id="91" class="line"></br></div>
<div id="92" class="line"><font class="Comment">;</font></br></div>
<div id="93" class="line"><font class="Comment">; Branche en "label" si (reg) < num, sinon continue</font></br></div>
<div id="94" class="line"><font class="Comment">;</font></br></div>
<div id="95" class="line"><font class="Normal">Blt macro label,reg,num</font></br></div>
<div id="96" class="line"><font class="Normal"> movlw num</font></br></div>
<div id="97" class="line"><font class="Normal"> subwf reg,W </font><font class="Comment">; reg - W</font></br></div>
<div id="98" class="line"><font class="Normal"> btfss STATUS,C </font></br></div>
<div id="99" class="line"><font class="Normal"> goto label </font><font class="Comment">; C=0 => reg - W < 0</font></br></div>
<div id="100" class="line"><font class="Normal"> endm</font></br></div>
<div id="101" class="line"></br></div>
<div id="102" class="line"><font class="Comment">;</font></br></div>
<div id="103" class="line"><font class="Comment">; Branche en "label" si (reg) >= num, sinon continue</font></br></div>
<div id="104" class="line"><font class="Comment">;</font></br></div>
<div id="105" class="line"><font class="Normal">Bge macro label,reg,num</font></br></div>
<div id="106" class="line"><font class="Normal"> movlw num</font></br></div>
<div id="107" class="line"><font class="Normal"> subwf reg,W </font><font class="Comment">; reg - W</font></br></div>
<div id="108" class="line"><font class="Normal"> btfsc STATUS,C </font></br></div>
<div id="109" class="line"><font class="Normal"> goto label </font><font class="Comment">; C=1 => reg - W >= 0</font></br></div>
<div id="110" class="line"><font class="Normal"> endm</font></br></div>
<div id="111" class="line"><font class="Comment">; ========================================================</font></br></div>
<div id="112" class="line"><font class="Normal"> </font><font class="Comment">; CONFIG word ( en FFF )</font></br></div>
<div id="113" class="line"><font class="Normal"> </font><font class="Comment">; bits 11:5 don't care</font></br></div>
<div id="114" class="line"><font class="Normal"> </font><font class="Comment">; bit 4 : MCLRE enabled = 1, tied to Vdd = 0</font></br></div>
<div id="115" class="line"><font class="Normal"> </font><font class="Comment">; bit 3 : code protection off = 1, on = 0</font></br></div>
<div id="116" class="line"><font class="Normal"> </font><font class="Comment">; bit 2 : no watchdog = 0, watchdog = 1</font></br></div>
<div id="117" class="line"><font class="Normal"> </font><font class="Comment">; bit 1-0 ; EXTRC = 00, INTRC = 10, XT = 01, LP = 00</font></br></div>
<div id="118" class="line"><font class="Normal"> </font></br></div>
<div id="119" class="line"><font class="Normal"> __CONFIG B</font><font class="Char">'0</font><font class="Normal">00000001101</font><font class="Char">' </font><font class="Comment">; (horloge a quartz, avec watchdog) </font></br></div>
<div id="120" class="line"><font class="Comment">; ======================================================== </font></br></div>
<div id="121" class="line"><font class="Normal"> org </font><font class="DecVal">0</font></br></div>
<div id="122" class="line"><font class="Normal"> goto debut</font></br></div>
<div id="123" class="line"><font class="Comment">;=========================================================</font></br></div>
<div id="124" class="line"><font class="Comment">; sous-programmes</font></br></div>
<div id="125" class="line"><font class="Comment">; ========================================================</font></br></div>
<div id="126" class="line"><font class="Comment">; regarde si le timer est passe a 0</font></br></div>
<div id="127" class="line"><font class="Comment">; si oui, le compteur de ticks est incremente</font></br></div>
<div id="128" class="line"><font class="Comment">; et on attend le repassage a 1 </font></br></div>
<div id="129" class="line"><font class="Comment">; Cette routine DOIT etre appelee tout les 2/100 s ou plus souvent</font></br></div>
<div id="130" class="line"><font class="Normal">tickcount</font></br></div>
<div id="131" class="line"><font class="Normal"> clrwdt</font></br></div>
<div id="132" class="line"><font class="Normal"> movf TMR0,W</font></br></div>
<div id="133" class="line"><font class="Normal"> btfss STATUS,Z</font></br></div>
<div id="134" class="line"><font class="Normal"> retlw </font><font class="DecVal">0</font></br></div>
<div id="135" class="line"><font class="Normal"> </font></br></div>
<div id="136" class="line"><font class="Normal"> incf TICKS,F</font></br></div>
<div id="137" class="line"><font class="Comment">; attendre que le timer ait depasse 0</font></br></div>
<div id="138" class="line"><font class="Normal">waitnoZ</font></br></div>
<div id="139" class="line"><font class="Normal"> clrwdt</font></br></div>
<div id="140" class="line"><font class="Normal"> movf TMR0,W</font></br></div>
<div id="141" class="line"><font class="Normal"> btfsc STATUS,Z</font></br></div>
<div id="142" class="line"><font class="Normal"> goto waitnoZ</font></br></div>
<div id="143" class="line"><font class="Normal"> retlw </font><font class="DecVal">0</font></br></div>
<div id="144" class="line"><font class="Comment">; </font></br></div>
<div id="145" class="line"><font class="Comment">; les 2 fct qui suivent maintiennent, le compteur de ticks</font></br></div>
<div id="146" class="line"><font class="Comment">; (en plus de scruter une patte)</font></br></div>
<div id="147" class="line"><font class="Comment">; attente d'un signal (logique negative)</font></br></div>
<div id="148" class="line"><font class="Normal">waitsignal</font></br></div>
<div id="149" class="line"><font class="Normal"> </font><font class="Keyword">call</font><font class="Normal"> tickcount</font></br></div>
<div id="150" class="line"><font class="Normal"> btfsc GPIO,SIGNAL</font></br></div>
<div id="151" class="line"><font class="Normal"> goto waitsignal</font></br></div>
<div id="152" class="line"><font class="Normal"> retlw </font><font class="DecVal">0</font></br></div>
<div id="153" class="line"><font class="Comment">; attente fin signal</font></br></div>
<div id="154" class="line"><font class="Normal">waitnosignal</font></br></div>
<div id="155" class="line"><font class="Normal"> </font><font class="Keyword">call</font><font class="Normal"> tickcount</font></br></div>
<div id="156" class="line"><font class="Normal"> btfss GPIO,SIGNAL</font></br></div>
<div id="157" class="line"><font class="Normal"> goto waitnosignal</font></br></div>
<div id="158" class="line"><font class="Normal"> retlw </font><font class="DecVal">0</font></br></div>
<div id="159" class="line"><font class="Comment">; remet a zero le compteur de ticks et le timer et le watchdog</font></br></div>
<div id="160" class="line"><font class="Normal">clearticks</font></br></div>
<div id="161" class="line"><font class="Normal"> clrwdt</font></br></div>
<div id="162" class="line"><font class="Normal"> clrw</font></br></div>
<div id="163" class="line"><font class="Normal"> movwf TICKS</font></br></div>
<div id="164" class="line"><font class="Normal"> movwf TMR0</font></br></div>
<div id="165" class="line"><font class="Normal"> </font><font class="Comment">; pour eviter un timeout immediat, le timer est charge </font></br></div>
<div id="166" class="line"><font class="Normal"> </font><font class="Comment">; a 1, et le 1er tick ne fait que 0.019922s au lieu de 0.2s</font></br></div>
<div id="167" class="line"><font class="Normal"> </font><font class="Comment">; (ce n'est pas grave dans la mesure ou de toute facon,</font></br></div>
<div id="168" class="line"><font class="Normal"> </font><font class="Comment">; le temps de traitement entre les different declenchements </font></br></div>
<div id="169" class="line"><font class="Normal"> </font><font class="Comment">; de chrono n'est pas nul)</font></br></div>
<div id="170" class="line"><font class="Normal"> incf TMR0,F </font></br></div>
<div id="171" class="line"><font class="Normal"> retlw </font><font class="DecVal">0</font></br></div>
<div id="172" class="line"></br></div>
<div id="173" class="line"><font class="Comment">;</font></br></div>
<div id="174" class="line"><font class="Comment">; ==========================================================</font></br></div>
<div id="175" class="line"><font class="Comment">; </font></br></div>
<div id="176" class="line"><font class="Normal">debut </font></br></div>
<div id="177" class="line"><font class="Normal"> </font><font class="Comment">; reset par Watchdog ?</font></br></div>
<div id="178" class="line"><font class="Normal"> btfsc STATUS,TO</font></br></div>
<div id="179" class="line"><font class="Normal"> goto notimeout</font></br></div>
<div id="180" class="line"><font class="Normal"> </font><font class="Comment">; TO == 0 : OUI</font></br></div>
<div id="181" class="line"><font class="Normal"> clrwdt</font></br></div>
<div id="182" class="line"><font class="Normal"> goto </font><font class="BaseN">0x1FF</font><font class="Normal"> </font><font class="Comment">; recalibrage, 0x3FF sur 12C509</font></br></div>
<div id="183" class="line"><font class="Normal"> </font></br></div>
<div id="184" class="line"><font class="Normal"> </font><font class="Comment">; TO == 1 : NON</font></br></div>
<div id="185" class="line"><font class="Normal">notimeout </font></br></div>
<div id="186" class="line"><font class="Normal"> movwf OSCCAL </font><font class="Comment">; recalibrer l'horloge</font></br></div>
<div id="187" class="line"><font class="Normal"> clrf TMR0 </font><font class="Comment">; RAZ timer</font></br></div>
<div id="188" class="line"><font class="Normal"> </font><font class="Comment">; GPWU=1 : disable wake up on pin change</font></br></div>
<div id="189" class="line"><font class="Normal"> </font><font class="Comment">; GPPU=0 : enable pullups (a voir avec le hard ..)</font></br></div>
<div id="190" class="line"><font class="Normal"> </font><font class="Comment">; T0CS=0 : timer connected to F/4</font></br></div>
<div id="191" class="line"><font class="Normal"> </font><font class="Comment">; T0SE=x : dont't care</font></br></div>
<div id="192" class="line"><font class="Normal"> </font><font class="Comment">; PSA=0 : prescaler assigned to timer</font></br></div>
<div id="193" class="line"><font class="Normal"> </font><font class="Comment">; PS2-0= : timer prescaler 111= 1/256, 101 = 1/64, 011 = 1/16</font></br></div>
<div id="194" class="line"><font class="Normal"> movlw B</font><font class="Char">'1</font><font class="Normal">0010101</font><font class="Char">' </font></br></div>
<div id="195" class="line"><font class="Normal"> option </font></br></div>
<div id="196" class="line"><font class="Normal"> </font></br></div>
<div id="197" class="line"><font class="Normal"> </font><font class="Comment">; config des pattes</font></br></div>
<div id="198" class="line"><font class="Normal"> movlw B</font><font class="Char">'0</font><font class="Normal">0001000</font><font class="Char">' </font><font class="Comment">; GP0-2 en sortie, GP3 entree</font></br></div>
<div id="199" class="line"><font class="Normal"> tris GPIO</font></br></div>
<div id="200" class="line"><font class="Normal"> </font></br></div>
<div id="201" class="line"><font class="Normal"> </font><font class="Comment">; se mettre en mode normal</font></br></div>
<div id="202" class="line"><font class="Normal"> bcf GPIO,NORMAL</font></br></div>
<div id="203" class="line"><font class="Normal"> bsf GPIO,ALERTE</font></br></div>
<div id="204" class="line"><font class="Normal"> bsf GPIO,EJP</font></br></div>
<div id="205" class="line"><font class="Normal"> </font></br></div>
<div id="206" class="line"><font class="Normal"> </font></br></div>
<div id="207" class="line"><font class="Normal">attendre_trame</font></br></div>
<div id="208" class="line"><font class="Normal"> </font><font class="Keyword">call</font><font class="Normal"> waitnosignal </font><font class="Comment">; attendre ...</font></br></div>
<div id="209" class="line"><font class="Normal"> </font><font class="Keyword">call</font><font class="Normal"> waitsignal </font><font class="Comment">; ... front montant </font></br></div>
<div id="210" class="line"><font class="Normal"> </font><font class="Keyword">call</font><font class="Normal"> clearticks</font></br></div>
<div id="211" class="line"><font class="Normal"> </font><font class="Keyword">call</font><font class="Normal"> waitnosignal</font></br></div>
<div id="212" class="line"><font class="Normal"> </font><font class="Comment">; 45 tk = 0.9s, 55 tk = 1.1s</font></br></div>
<div id="213" class="line"><font class="Normal"> Lminmax TICKS,D</font><font class="Char">'4</font><font class="Normal">5</font><font class="Char">',</font><font class="Normal">D</font><font class="Char">'5</font><font class="Normal">5</font><font class="Char">',</font><font class="Normal">attendre_trame,pulse1s,attendre_trame</font></br></div>
<div id="214" class="line"><font class="Normal">pulse1s</font></br></div>
<div id="215" class="line"></br></div>
<div id="216" class="line"><font class="Normal"> </font><font class="Comment">; attendre 162,5 tk = 2.75 s + 0.5 s = 3.25 s</font></br></div>
<div id="217" class="line"><font class="Normal"> </font><font class="Keyword">call</font><font class="Normal"> clearticks</font></br></div>
<div id="218" class="line"><font class="Normal">again325</font></br></div>
<div id="219" class="line"><font class="Normal"> </font><font class="Keyword">call</font><font class="Normal"> tickcount</font></br></div>
<div id="220" class="line"><font class="Normal"> Lminmax TICKS,D</font><font class="Char">'1</font><font class="Normal">62</font><font class="Char">',</font><font class="Normal">D</font><font class="Char">'1</font><font class="Normal">62</font><font class="Char">',</font><font class="Normal">again325,again325,end325</font></br></div>
<div id="221" class="line"><font class="Normal">end325</font></br></div>
<div id="222" class="line"></br></div>
<div id="223" class="line"><font class="Normal"> </font><font class="Comment">; on est maintenant au centre du 1er bit</font></br></div>
<div id="224" class="line"><font class="Normal"> </font><font class="Comment">; il suffit d'echantillonner toutes les 2.5s</font></br></div>
<div id="225" class="line"><font class="Normal"> movlw </font><font class="DecVal">1</font></br></div>
<div id="226" class="line"><font class="Normal"> movwf SLOT</font></br></div>
<div id="227" class="line"><font class="Normal"> </font></br></div>
<div id="228" class="line"><font class="Normal">sample btfsc GPIO,SIGNAL </font><font class="Comment">; logique negative</font></br></div>
<div id="229" class="line"><font class="Normal"> goto slot40</font></br></div>
<div id="230" class="line"><font class="Normal"> </font></br></div>
<div id="231" class="line"><font class="Normal"> </font><font class="Comment">; signal detecte !!</font></br></div>
<div id="232" class="line"><font class="Normal"> Bne not5,SLOT,D</font><font class="Char">'5' </font><font class="Comment">; slot == 5 ?</font></br></div>
<div id="233" class="line"><font class="Normal"> </font><font class="Comment">; oui - 5 = passage en alerte</font></br></div>
<div id="234" class="line"><font class="Normal"> bsf GPIO,NORMAL </font><font class="Comment">; bit a 1 = LED eteinte</font></br></div>
<div id="235" class="line"><font class="Normal"> bsf GPIO,EJP </font><font class="Comment">; bit a 1 = LED eteinte</font></br></div>
<div id="236" class="line"><font class="Normal"> bcf GPIO,ALERTE </font><font class="Comment">; bit a 0 = LED allumee</font></br></div>
<div id="237" class="line"><font class="Normal"> goto nextslot</font></br></div>
<div id="238" class="line"><font class="Normal">not5</font></br></div>
<div id="239" class="line"><font class="Normal"> Bne not15,SLOT,D</font><font class="Char">'1</font><font class="Normal">5</font><font class="Char">' </font><font class="Comment">; slot == 15 ?</font></br></div>
<div id="240" class="line"><font class="Normal"> </font><font class="Comment">; oui</font></br></div>
<div id="241" class="line"><font class="Normal"> btfsc GPIO,ALERTE </font><font class="Comment">; deja en alerte ?</font></br></div>
<div id="242" class="line"><font class="Normal"> goto endejp</font></br></div>
<div id="243" class="line"><font class="Normal"> </font><font class="Comment">; oui - 5 & 15 = debut ejp </font></br></div>
<div id="244" class="line"><font class="Normal"> bsf GPIO,NORMAL </font><font class="Comment">; bit a 1 = LED eteinte</font></br></div>
<div id="245" class="line"><font class="Normal"> bsf GPIO,ALERTE </font><font class="Comment">; bit a 1 = LED eteinte</font></br></div>
<div id="246" class="line"><font class="Normal"> bcf GPIO,EJP </font><font class="Comment">; bit a 0 = LED allumee</font></br></div>
<div id="247" class="line"><font class="Normal"> goto nextslot</font></br></div>
<div id="248" class="line"><font class="Normal">endejp</font></br></div>
<div id="249" class="line"><font class="Normal"> </font><font class="Comment">; non - 15 seul = fin ejp</font></br></div>
<div id="250" class="line"><font class="Normal"> bsf GPIO,EJP </font><font class="Comment">; bit a 1 = LED eteinte</font></br></div>
<div id="251" class="line"><font class="Normal"> bsf GPIO,ALERTE </font><font class="Comment">; bit a 1 = LED eteinte</font></br></div>
<div id="252" class="line"><font class="Normal"> bcf GPIO,NORMAL </font><font class="Comment">; bit a 0 = LED allumee</font></br></div>
<div id="253" class="line"><font class="Normal"> goto nextslot</font></br></div>
<div id="254" class="line"><font class="Normal"> </font></br></div>
<div id="255" class="line"><font class="Normal">not15</font></br></div>
<div id="256" class="line"><font class="Normal">slot40</font></br></div>
<div id="257" class="line"><font class="Normal"> </font><font class="Comment">; slot 40 ?</font></br></div>
<div id="258" class="line"><font class="Normal"> Bne nextslot,SLOT,D</font><font class="Char">'4</font><font class="Normal">0</font><font class="Char">' </font><font class="Comment">; slot == 40 ?</font></br></div>
<div id="259" class="line"><font class="Normal"> </font><font class="Comment">; et attendre une nouvelle trame</font></br></div>
<div id="260" class="line"></br></div>
<div id="261" class="line"><font class="Normal"> goto attendre_trame</font></br></div>
<div id="262" class="line"><font class="Normal">nextslot</font></br></div>
<div id="263" class="line"><font class="Normal"> incf SLOT,F</font></br></div>
<div id="264" class="line"><font class="Normal"> </font></br></div>
<div id="265" class="line"><font class="Normal"> </font><font class="Comment">; si le signal est a 1, on en profite pour se resynchroniser</font></br></div>
<div id="266" class="line"><font class="Normal"> </font><font class="Comment">; sur son front descendant, au cas ou l'emetteur ne soit pas</font></br></div>
<div id="267" class="line"><font class="Normal"> </font><font class="Comment">; bien conforme au protocole.</font></br></div>
<div id="268" class="line"><font class="Normal"> btfss GPIO,SIGNAL</font></br></div>
<div id="269" class="line"><font class="Normal"> goto resynchro</font></br></div>
<div id="270" class="line"><font class="Normal"> </font><font class="Comment">; attendre 125 ticks = 2.5s</font></br></div>
<div id="271" class="line"><font class="Normal"> </font><font class="Keyword">call</font><font class="Normal"> clearticks</font></br></div>
<div id="272" class="line"><font class="Normal">again125</font></br></div>
<div id="273" class="line"><font class="Normal"> </font><font class="Keyword">call</font><font class="Normal"> tickcount</font></br></div>
<div id="274" class="line"><font class="Normal"> Lminmax TICKS,D</font><font class="Char">'1</font><font class="Normal">25</font><font class="Char">',</font><font class="Normal">D</font><font class="Char">'1</font><font class="Normal">26</font><font class="Char">',</font><font class="Normal">again125,sample,again125</font></br></div>
<div id="275" class="line"><font class="Normal"> </font></br></div>
<div id="276" class="line"><font class="Normal">resynchro </font></br></div>
<div id="277" class="line"><font class="Normal"> </font><font class="Keyword">call</font><font class="Normal"> waitnosignal</font></br></div>
<div id="278" class="line"><font class="Normal"> </font><font class="Keyword">call</font><font class="Normal"> clearticks</font></br></div>
<div id="279" class="line"><font class="Normal">again100 </font><font class="Comment">; attente 2 s (100 ticks) </font></br></div>
<div id="280" class="line"><font class="Normal"> </font><font class="Keyword">call</font><font class="Normal"> tickcount</font></br></div>
<div id="281" class="line"><font class="Normal"> Lminmax TICKS,D</font><font class="Char">'1</font><font class="Normal">00</font><font class="Char">',</font><font class="Normal">D</font><font class="Char">'1</font><font class="Normal">01</font><font class="Char">',</font><font class="Normal">again100,sample,again100</font></br></div>
<div id="282" class="line"></br></div>
<div id="283" class="line"><font class="Normal"> end</font></br></div>
<div id="284" class="line"></br></div>
<div id="285" class="line"></br></div>
</div>
</body>
</html>