File "debug.lst"
Full Path: /home/analogde/www/private/Projet/debug/debug.lst
File size: 22.32 KB
MIME-type: text/plain
Charset: 8 bit
WARNING: EXTCODE CODE AREA DO NOT CONTAIN RELOCATED ADDRESSES.
THIS WILL BE REMEDIED IN A LATER RELEASE.
WARNING: EXTCODE CODE AREA DO NOT CONTAIN RELOCATED ADDRESSES.
THIS WILL BE REMEDIED IN A LATER RELEASE.
WARNING: EXTCODE CODE AREA DO NOT CONTAIN RELOCATED ADDRESSES.
THIS WILL BE REMEDIED IN A LATER RELEASE.
WARNING: EXTCODE CODE AREA DO NOT CONTAIN RELOCATED ADDRESSES.
THIS WILL BE REMEDIED IN A LATER RELEASE.
WARNING: EXTCODE CODE AREA DO NOT CONTAIN RELOCATED ADDRESSES.
THIS WILL BE REMEDIED IN A LATER RELEASE.
.module debug.c
.area text
; baud -> 2,x
202A _init_SCI::
; #include "HC12.H"
;
; int Mille,Centaine,Dizaine,Unite;
;
; int val;
;
; unsigned int canal[8];
; char ascii[8];
;
; /**************************************************************************/
; void init_SCI(unsigned int baud)
; {
; asm(" SEI");
202A 1410 SEI
;
; SCICR1 = 0x00; /* 0 0 0 0 0 0 0 0 /* 8bits et pas de parit */
202C 7900CA clr 0xca
; /* | | | | | | | |
; | | | | | | | \____ Even Parity
; | | | | | | \______ Parity Disabled
; | | | | | \________ Short IDLE line mode (not used)
; | | | | \__________ Wakeup by IDLE line rec (not used)
; | | | \____________ 8 data bits
; | | \______________ Not used (loopback disabled)
; | \________________ SCI1 enabled in wait mode
; \__________________ Normal (not loopback) mode
; */
; SCICR2 = 0x2C; /* 0 0 1 0 1 1 0 0 /* TX et RX actif + RX int*/
202F C62C ldab #44
2031 7B00CB stab 0xcb
; /* | | | | | | | |
; | | | | | | | \____ No Break
; | | | | | | \______ Not in wakeup mode (always awake)
; | | | | | \________ Reciever enabled
; | | | | \__________ Transmitter disabled
; | | | \____________ No IDLE Interrupt
; | | \______________ Reciever Interrupts used
; | \________________ No Tranmit Complete Interrupt
; \__________________ No Tranmit Ready Interrupt
; */
; SCIBDH = 0x00;
2034 7900C8 clr 0xc8
; SCIBDL = 0x34; // 9600 bauds (52 en dcimal)
2037 C634 ldab #52
2039 7B00C9 stab 0xc9
; asm(" CLI");
203C 10EF CLI
; }
203E L1:
203E .dbline 0 ; func end
203E 3D rts
203F _initialise_SCI::
;
; /**************************************************************************/
; void initialise_SCI(void)
; {
; SCIBDH = 0x34; // 9600bps @ 8MHz Mclk
203F C634 ldab #52
2041 7B00C8 stab 0xc8
; SCIBDL = 0x00;
2044 7900C9 clr 0xc9
; SCICR1 = 0x00; // mode normal 8bits
2047 7900CA clr 0xca
; SCICR2 = 0x0C; // pas d'interruption, pas de parit
204A C60C ldab #12
204C 7B00CB stab 0xcb
; }
204F L2:
204F .dbline 0 ; func end
204F 3D rts
2050 _init_ADC::
; /**************************************************************************/
; void init_ADC(void)
; {
; ATDCTL2 = 0xC0; /* dmarrage ADC */
2050 C6C0 ldab #192
2052 7B0122 stab 0x122
; ATDCTL3 = 0x00; /* cycle de 8 conversions */
2055 790123 clr 0x123
; ATDCTL4 = 0x75; /* mode 10 bits */
2058 C675 ldab #117
205A 7B0124 stab 0x124
; ATDCTL5 = 0x90; /* 1 0 0 1 0 0 0 0
205D C690 ldab #144
205F 7B0125 stab 0x125
; | | | | \__/
; | | | | |
; | | | | \___ First channel = 2
; | | | \________ MULT = 1 => multiple channels
; | | \__________ SCAN = 0 => one set of conversions
; | \____________ DSGN = 0 => unsigned
; \______________ DJM = 1 => right justified
; */
; }
2062 L3:
2062 .dbline 0 ; func end
2062 3D rts
; i -> -2,x
; data -> 3,x
2063 _ecrire_data::
2063 3B pshd
2064 34 pshx
2065 B775 tfr s,x
2067 1B9E leas -2,sp
; /**********************************************************/
; void ecrire_data(char data)
; {
; int i;
;
; i= 0x55;
2069 CC0055 ldd #85
206C 6C1E std -2,x
;
; return;
206E L4:
206E B757 tfr x,s
2070 30 pulx
2071 1B82 leas 2,sp
2073 .dbline 0 ; func end
2073 3D rts
; buffer -> 2,x
2074 _ecrire_chaine::
2074 3B pshd
2075 34 pshx
2076 B775 tfr s,x
; }
; /**********************************************************/
; void ecrire_chaine(char *buffer)
; {
2078 200F bra L7
207A L6:
207A ED02 ldy 2,x
207C E640 ldab 0,y
207E 87 clra
207F 162063 jsr _ecrire_data
2082 EC02 ldd 2,x
2084 C30001 addd #1
2087 6C02 std 2,x
2089 L7:
; while(*buffer)
2089 ED02 ldy 2,x
208B E740 tst 0,y
208D 26EB bne L6
; { ecrire_data(*buffer);
; buffer++;
; }
; return;
208F L5:
208F B757 tfr x,s
2091 30 pulx
2092 1B82 leas 2,sp
2094 .dbline 0 ; func end
2094 3D rts
; compare -> -2,x
2095 _conversion_decimal::
2095 34 pshx
2096 B775 tfr s,x
2098 1B9E leas -2,sp
; }
; /**********************************************************/
; void conversion_decimal(void)
; {
;
; int compare;
;
; Mille = 0;
209A CC0000 ldd #0
209D 7C2235 std _Mille
; Centaine = 0;
20A0 CC0000 ldd #0
20A3 7C2233 std _Centaine
; Dizaine = 0;
20A6 CC0000 ldd #0
20A9 7C2231 std _Dizaine
; Unite = 0;
20AC CC0000 ldd #0
20AF 7C222F std _Unite
;
; // recherche du nombre en dcimal - 4 chiffres
;
; compare=val;
20B2 18011E222D movw _val,-2,x
20B7 2010 bra L11
20B9 L10:
20B9 FC2235 ldd _Mille
20BC C30001 addd #1
20BF 7C2235 std _Mille
20C2 EC1E ldd -2,x
20C4 8303E8 subd #1000
20C7 6C1E std -2,x
20C9 L11:
;
; while( compare > 1000 ) // nombre de paquets de 1000
20C9 EC1E ldd -2,x
20CB 8C03E8 cpd #1000
20CE 2EE9 bgt L10
20D0 2010 bra L14
20D2 L13:
20D2 FC2233 ldd _Centaine
20D5 C30001 addd #1
20D8 7C2233 std _Centaine
20DB EC1E ldd -2,x
20DD 830064 subd #100
20E0 6C1E std -2,x
20E2 L14:
; { Mille++;
; compare=compare-1000;
; }
; while( compare > 100 ) // nombre de centaines
20E2 EC1E ldd -2,x
20E4 8C0064 cpd #100
20E7 2EE9 bgt L13
20E9 2010 bra L17
20EB L16:
20EB FC2231 ldd _Dizaine
20EE C30001 addd #1
20F1 7C2231 std _Dizaine
20F4 EC1E ldd -2,x
20F6 83000A subd #10
20F9 6C1E std -2,x
20FB L17:
; { Centaine++;
; compare=compare-100;
; }
; while( compare > 10 ) // nombre de dizaines
20FB EC1E ldd -2,x
20FD 8C000A cpd #10
2100 2EE9 bgt L16
; { Dizaine++;
; compare=compare-10;
; }
;
; Unite=compare;
2102 18051E222F movw -2,x,_Unite
; }
2107 L9:
2107 B757 tfr x,s
2109 30 pulx
210A .dbline 0 ; func end
210A 3D rts
210B _conversion_Ascii::
; /**********************************************************/
; void conversion_Ascii(void)
; {
;
; ascii[0]=Mille+0x30;
210B FC2235 ldd _Mille
210E C30030 addd #48
2111 7B2215 stab _ascii
; ascii[1]='.'; // affiche virgule
2114 C62E ldab #46
2116 7B2216 stab _ascii+1
; ascii[2]=Centaine+0x30; // centaines de mV
2119 FC2233 ldd _Centaine
211C C30030 addd #48
211F 7B2217 stab _ascii+2
; ascii[3]=Dizaine+0x30; // dizaines de mV
2122 FC2231 ldd _Dizaine
2125 C30030 addd #48
2128 7B2218 stab _ascii+3
; ascii[4]=Unite+0x30; // affiche les mV
212B FC222F ldd _Unite
212E C30030 addd #48
2131 7B2219 stab _ascii+4
; ascii[5]='V'; // affiche le V de Volt
2134 C656 ldab #86
2136 7B221A stab _ascii+5
; }
2139 L19:
2139 .dbline 0 ; func end
2139 3D rts
213A _acquisition::
; /**********************************************************/
; void acquisition(void)
; {
; ATDCTL5 = 0x90; // lance la conversion
213A C690 ldab #144
213C 7B0125 stab 0x125
213F L26:
213F L27:
;
; while ((ADSTAT0 & 0x80) == 0 ) ; /* attendre la fin de la conversion */
213F 1F012680FB brclr 0x126,#128,L26
; canal[0] = ADR0;
; vol
2144 FD0130 ldy 0x130
2147 7D221D sty _canal
; canal[1] = ADR1;
; vol
214A FD0132 ldy 0x132
214D 7D221F sty _canal+2
; canal[2] = ADR2;
; vol
2150 FD0134 ldy 0x134
2153 7D2221 sty _canal+4
; canal[3] = ADR3;
; vol
2156 FD0136 ldy 0x136
2159 7D2223 sty _canal+6
; canal[4] = ADR4;
; vol
215C FD0138 ldy 0x138
215F 7D2225 sty _canal+8
; canal[5] = ADR5;
; vol
2162 FD013A ldy 0x13a
2165 7D2227 sty _canal+10
; canal[6] = ADR6;
; vol
2168 FD013C ldy 0x13c
216B 7D2229 sty _canal+12
; canal[7] = ADR7;
; vol
216E FD013E ldy 0x13e
2171 7D222B sty _canal+14
; }
2174 L25:
2174 .dbline 0 ; func end
2174 3D rts
2175 _traitement::
; /**************************************************************************/
; void traitement(void)
; {
;
; // lire le rsultat + stockage
; canal[6]= ADR6;
; vol
2175 FD013C ldy 0x13c
2178 7D2229 sty _canal+12
;
; val= (ADR6 * 4888)/10000;
217B CC1318 ldd #4888
; vol
217E FD013C ldy 0x13c
2181 13 emul
2182 CD2710 ldy #10000
2185 B7D6 exg x,y
2187 1810 idiv
2189 B7D6 exg x,y
218B 7D222D sty _val
;
; }
218E L36:
218E .dbline 0 ; func end
218E 3D rts
; c -> 3,x
218F _envoi_caractere::
218F 3B pshd
2190 34 pshx
2191 B775 tfr s,x
; /**************************************************************************/
; void envoi_caractere(char c)
; {
2193 L39:
2193 L40:
; while( (SCISR1 & 0x80 )== 0 ); // attendre la monte du flag TDRE
2193 1F00CC80FB brclr 0xcc,#128,L39
; SCIDRL = c;
2198 180D0300CF movb 3,x,0xcf
;
; }
219D L38:
219D B757 tfr x,s
219F 30 pulx
21A0 1B82 leas 2,sp
21A2 .dbline 0 ; func end
21A2 3D rts
; ptr -> -2,x
; str -> 2,x
21A3 _envoi_chaine::
21A3 3B pshd
21A4 34 pshx
21A5 B775 tfr s,x
21A7 1B9E leas -2,sp
; /**********************************************************/
; void envoi_chaine(char str[])
; {
; char *ptr;
;
; for(ptr = str; *ptr != '\0' ; ptr++ )
21A9 1802021E movw 2,x,-2,x
21AD 200F bra L46
21AF L43:
21AF ED1E ldy -2,x
21B1 E640 ldab 0,y
21B3 87 clra
21B4 16218F jsr _envoi_caractere
21B7 L44:
21B7 EC1E ldd -2,x
21B9 C30001 addd #1
21BC 6C1E std -2,x
21BE L46:
21BE ED1E ldy -2,x
21C0 E740 tst 0,y
21C2 26EB bne L43
; { envoi_caractere(*ptr);
; }
; }
21C4 L42:
21C4 B757 tfr x,s
21C6 30 pulx
21C7 1B82 leas 2,sp
21C9 .dbline 0 ; func end
21C9 3D rts
21CA _transmettre_CRLF::
; /**************************************************************************/
; void transmettre_CRLF(void)
; {
; SCIDRL = 0x0A; // fin de ligne = end of line
21CA C60A ldab #10
21CC 7B00CF stab 0xcf
21CF L48:
21CF L49:
; while ( (SCISR1 & 0x80) == 0) ; // attendre le flag TDRE
21CF 1F00CC80FB brclr 0xcc,#128,L48
; SCIDRL = 0x0D; // retour la ligne = line feed
21D4 C60D ldab #13
21D6 7B00CF stab 0xcf
21D9 L51:
21D9 L52:
; while ( (SCISR1 & 0x80) == 0) ; // attendre le flag TDRE
21D9 1F00CC80FB brclr 0xcc,#128,L51
;
; }
21DE L47:
21DE .dbline 0 ; func end
21DE 3D rts
; ptr -> -2,x
21DF _main::
21DF 34 pshx
21E0 B775 tfr s,x
21E2 1B9E leas -2,sp
; /**************************************************************************/
; void main(void)
; {
; /*char buffer[10]="";
;
; char v;
; char *ptr;
;
; buffer[0]='A';
; buffer[1]='b';
; buffer[2]='c';
; buffer[3]='d';
;
; v=buffer[2];
; p=ascii;
; ecrire_chaine(p);*/
;
; char *ptr;
;
; COPCTL=0x00;
21E4 79003C clr 0x3c
; init_ADC();
21E7 162050 jsr _init_ADC
; init_SCI(9600);
21EA CC2580 ldd #9600
21ED 16202A jsr _init_SCI
21F0 2019 bra L56
21F2 L55:
21F2 1621CA jsr _transmettre_CRLF
21F5 16213A jsr _acquisition
21F8 162175 jsr _traitement
21FB 162095 jsr _conversion_decimal
21FE 16210B jsr _conversion_Ascii
2201 CC2215 ldd #_ascii
2204 6C1E std -2,x
2206 EC1E ldd -2,x
2208 1621A3 jsr _envoi_chaine
220B L56:
;
; while(1)
220B 20E5 bra L55
220D X0:
; { transmettre_CRLF();
; acquisition();
; traitement();
; conversion_decimal();
; conversion_Ascii();
; ptr=ascii;
; envoi_chaine(ptr);
; }
; }
220D L54:
220D B757 tfr x,s
220F 30 pulx
2210 .dbline 0 ; func end
2210 3D rts
.area bss
2215 _ascii::
2215 .blkb 8
221D _canal::
221D .blkb 16
222D _val::
222D .blkb 2
222F _Unite::
222F .blkb 2
2231 _Dizaine::
2231 .blkb 2
2233 _Centaine::
2233 .blkb 2
2235 _Mille::
2235 .blkb 2