DPRG
DPRG List  



DPRG: HC811E2 A/D converter

Subject: DPRG: HC811E2 A/D converter
From: barry jordan barry_jordan at email.msn.com
Date: Mon Jan 26 22:01:15 CST 1998

I am also trying to write in Sbasic to load to Botboards.
Attached is my bumper code, that I am having trouble with.
Let's get together and compare notes.
In the meantime, I'll ponder your delima.

- -----Original Message-----
>From: garrett myrick <gamyrick at linknet.kitsap.lib.wa.us>
To: DPRG Email list <dprglist at dprg.org>; SRS Email List
<srs at seattlerobotics.org>
Date: Monday, January 26, 1998 5:22 PM
Subject: DPRG: HC811E2 A/D converter


>
>Hi,
>
>
>
>Basically all I want to know is: How do you use the A/D converter system
>on an hc811e2? I wrote a small program in Karl Lunt's Sbasic that first
>sets the ADPU bit in the OPTION register, waits more than long enough for
>the A/D system to power up, then writes a 0 to the ADCTL register to start
>the conversion. It polls the ADCTL register until the CCF flag sets, and
>then it is supposed to take the data in the ADR1 register and copy it to
>port B where I am supposed to be able to see it on an LED bargraph. When I
>loaded this program into the BOTBoard, nothing happened. I thought that it
>was probably getting stuck in one of the loops. So what I did was to poke
>a 1 to port B in the first loop, and after it got out of the loop it would
>clear port B. The second loop would write a two, etc., so that I could see
>where it was getting stuck. I loaded these changes, and found out that it
>was getting stuck in the first loop, which meant that the CCF flag never
>set, which probably means that no conversion ever took place. I have
>looked through the  Motorola reference manual (the one specifically for
>the E series, not the pink book), and can't seem to find out what the
>problem is. What am I doing wrong?
>
>Thanks,
>
>Garrett Myrick
><gamyrick at linknet.kitsap,lib.wa.us>
>
>
>
>


begin 666 Rosie12.bas
M)R!2;W-I93$R#0H-"FEN8VQU9&4@(G)E9W,Q,2YL:6(B#0II;F-L=61E(")S
M97)V;W,N8F%S(@T*#0ID96-L87)E(%-E;G-O<DEN<'5T"0DG($EN<'5T('-E
M;G-O<B!D871A#0ID96-L87)E($)E:&%V95-T871E"0DG(%!R979I;W5S(&)E
M:&%V:6]R#0ID96-L87)E($1E;&%Y7U1I;65R"0DG(%1I;6EN9R!F;W(@='5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9#H-"@EP;VME
M("!23512+"!21E=$#0H)<&]K92 @3$U44BP at 3$971 T*"7)E='5R;@T*#0I-
M;W1O<G-?36]V95]"86-K=V%R9#H-"@EP;VME("!23512+"!24D56#0H)<&]K
M92 @3$U44BP at 3%)%5 at T*(" @(" @("!R971U<FX-"@T*36]T;W)S7U1U<FY?
M3&5F=#H-"B @(" @(" @<&]K92 @4DU44BP at 4D971 T*"7!O:V4@($Q-5%(L
M($Q2158-"B @(" @(" @<F5T=7)N#0H-"DUO=&]R<U]4=7)N7U)I9VAT. at T*
M"7!O:V4@(%)-5%(L(%)2158-"@EP;VME("!,3512+"!,1E=$#0H@(" @(" @
M(')E='5R;@T*#0I-;W1O<G-?36]V95]3=&]P. at T*"7!O:V4@(%)-5%(L($UO
M=&]R7U-T;W -"@EP;VME("!,3512+"!-;W1O<E]3=&]P#0H@(" @(" @(')E
M='5R;@T*#0I3=&%R=%1U<FY$96QA>3H-"@E$96QA>5]4:6UE<B ](#(U-0T*
M"7)E='5R;@T*#0I3=&]P5'5R;D1E;&%Y. at T*"41E;&%Y7U1I;65R(#T@, T*
M"7)E='5R;@T*#0I);FET:6%L:7IE7U)O8F]T. at T*(" @(" @#0H))U-E="!T
M:&4 at 9&%T82!D:7)E8W1I;VX@<F5G:7-T97(@9F]R('1H92!S96YS;W(@:6YP
M=71S#0H)<&]K96(@("!396YS;W)?4&]R=%]$1%(L(%-E;G-O<E]$1%)#7U9A
M;'5E#0H)9V]S=6(@36]T;W)S7TUO=F5?4W1O< T*"4)E:&%V95-T871E(#T@
M0F5H879E7T9O<G=A<F0-"@E396YS;W));G!U=" ](# -"@ER971U<FX-"@T*
M4V5N<V]R7U)E860Z#0H-"@E396YS;W));G!U=" ]('!E96MB*%-E;G-O<E]0
M;W)T*2!!3D0 at 4V5N<V]R7TUA<VL-"@D))R!);G!U="!S=VET8VAE<R!A<F4@
M86-T:79E(&QO=RX at 1FQI<"!T:&4@<V5N<V4@;V8-"@D))R!T:&4 at 8FET<R!S
M;R!T:&5Y(&%R92!A8W1I=F4@:&EG:"!I;B!T:&4@=F%R:6%B;&4-"@D))R!4
M:&ES(&%L;&]W<R!T:&5M('1O(&)E('1E<W1E9"!C;W)R96-T;'D@:6X@=&AE
M#0H)"2<@<F5S="!O9B!T:&4@<')O9W)A;0T*"5-E;G-O<DEN<'5T(#T at 4V5N
M<V]R26YP=70 at 6$]2(%-E;G-O<E]"=6UP97)?36%S:PT*"7)E='5R;@T*#0I"
M96AA=F4Z#0H-"FEF("A396YS;W));G!U="!!3D0 at 4V5N<V]R7T)U;7!E<E],
M969T*2 \/B P#0H)"2<@5V4 at 87)E(&AI='1I;F<@<V]M971H:6YG(&]N('1H
M92!F<F]N="!L969T+ at T*"0DG($)A8VL@;V9F(&]F(&ET#0H)9V]S=6(@36]T
M;W)S7TUO=F5?0F%C:W=A<F0-"B @(" @(" @9V]S=6(@4W1O<%1U<FY$96QA
M>0T*(" @(" @("!"96AA=F53=&%T92 ]($)E:&%V95]"86-K7TQE9G0-"@T*
M("!E;'-E:68@*%-E;G-O<DEN<'5T($%.1"!396YS;W)?0G5M<&5R7U)I9VAT
M*2 \/B P#0H@(" @(" @( DG(%=E(&%R92!H:71T:6YG('-O;65T:&EN9R!O
M;B!T:&4 at 9G)O;G0@<FEG:'0N#0H@(" @(" @( DG($)A8VL@;V9F(&]F(&ET
M#0H@(" @(" @(&=O<W5B($UO=&]R<U]-;W9E7T)A8VMW87)D#0H@(" @(" @
M(&=O<W5B(%-T;W!4=7)N1&5L87D-"B @(" @(" @0F5H879E4W1A=&4@/2!"
M96AA=F5?0F%C:U]2:6=H= T*#0H@(&5L<V5I9B H4V5N<V]R26YP=70 at 04Y$
M(%-E;G-O<E]"=6UP97)?0F%C:RD@/#X@, T*(" @(" @(" ))R!792!J=7-T
M(&)A8VME9"!I;G1O('-O;65T:&EN9RP at 9V\@9F]R=V%R9 T*(" @(" @("!G
M;W-U8B!-;W1O<G-?36]V95]&;W)W87)D#0H@(" @(" @(&=O<W5B(%-T;W!4
M=7)N1&5L87D-"B @(" @(" @0F5H879E4W1A=&4@/2!"96AA=F5?1F]R=V%R
M9 T*("!E;'-E#0H@(" )"2<@5&AE(&)U;7!E<B!S=VET8VAE<R!A<F4 at 8VQE
M87(N(%1H97)E9F]R92P@=V4-"B @(" @(" @"2<@<V5T(&]U<B!S=&%T92!B
M87-E9"!O;B!T:&4 at 8F5H879I;W5R(&EN9F]R;6%T:6]N#0H@('-E;&5C=" H
M0F5H879E4W1A=&4I#0H-"@EC87-E($)E:&%V95]"86-K7TQE9G0-"@D))R!7
M92!W97)E(&)A8VMI;F<@8F5C875S92!O9B!S;VUE=&AI;F<@;VX@;&5F= T*
M"0DG(%1U<FX@=&\@=&AE(')I9VAT#0H)("!G;W-U8B!-;W1O<G-?5'5R;E]2
M:6=H= T*"2 @0F5H879E4W1A=&4@/2!"96AA=F5?5'5R;E]2:6=H= T*"2 @
M9V]S=6(@4W1A<G14=7)N1&5L87D-"@EE;F1C87-E#0H-"@EC87-E($)E:&%V
M95]"86-K7U)I9VAT#0H)"2<@5V4@=V5R92!B86-K:6YG(&)E8V%U<V4@;V8@
M<V]M971H:6YG(&]N(')I9VAT#0H)"2<@5'5R;B!T;R!T:&4@;&5F= T*"2 @
M9V]S=6(@36]T;W)S7U1U<FY?3&5F= T*"2 @0F5H879E4W1A=&4@/2!"96AA
M=F5?5'5R;E],969T#0H)("!G;W-U8B!3=&%R=%1U<FY$96QA>0T*"65N9&-A
M<V4-"@T*"2 @(" ))R!4:&4 at 9&5F875L="!A8W1I;VX at 9F]R('1H92!C87-E
M('-T871E;65N="X-"@D@(" @"2<@268@=&AE(%1U<FY$96QA>4-O=6YT(&ES
M(%IE<F\L('1H96X@=V4 at 8V%N#0H)(" @( DG(&=O(&9O<G=A<F0N($]T:&5R
M=VES92P@=V4@=VEL;"!C;VYT:6YU92!T;PT*"2 @(" ))R!T=7)N(&EN('1H
M92!4=7)N1&5L87E#;W5N="!D:7)E8W1I;VXN#0H@(" @:68 at 1&5L87E?5&EM
M97(@/2 P#0H@(" @"6=O<W5B($UO=&]R<U]-;W9E7T9O<G=A<F0-"@E"96AA
M=F53=&%T92 ]($)E:&%V95]&;W)W87)D#0H@(" @96YD:68-"B @96YD<V5L
M96-T#0IE;F1I9 at T*<F5T=7)N#0H-"DUA:6XZ#0H))U-E='5P(%)422!T:6UE
M<B!I;G1E<G)U<'0-"@EP;VME8B!T;7-K,BP@<&5E:V(H=&US:S(I(&]R("4P
M,3 P,# P,* @)W!E<FUI="!25$D@:6YT97)R=7!T<PT*"7!O:V5B('1F;&<R
M+" E,#$P,# P,#"@H*"@H*"@H*"@"2=C;&5A<B!25$D at 9FQA9PT*"41E;&%Y
M7U1I;65R(#T@, T*"4EN=&5R<G5P=', at 3TX-"J"@H*"@H*"@H*"@H*"@H*"@
MH D-"B @(&=O<W5B"4EN<W1A;&Q397)V;RP at 4DU44@DG:6YS=&%L;"!R:6=H
M="!M;W1O<@T*(" @9V]S=6()26YS=&%L;%-E<G9O+"!,3512"2=I;G-T86QL
M(&QE9G0@;6]T;W(-"B @(&=O<W5B"4EN:71I86QI>F5?4F]B;W0-"@T*("!D
M;PT*(" @(&=O<W5B(%-E;G-O<E]296%D#0H@(" @9V]S=6(@0F5H879E#0H-
.."B @;&]O< T*96YD#0H`
`
end

------------------------------

More information about the DPRG mailing list