Shop OBEX P1 Docs P2 Docs Learn Events
ADC object works in one section of program, but not another section of same program??? - Page 2 — Parallax Forums

ADC object works in one section of program, but not another section of same program???

2»

Comments

  • Rayman wrote: »
    I think I see the problem...

    You have this in hover:
            Dira := Fpin
    

    This is forcing you I/O pin for the 3202 low and giving you zero readings...

    Fpin is 11, my 3202 is on 2,3,4. Fpin is the pin to count the freq on with, CTRA, Frqa, Phsa that follow.
  • Rayman wrote: »
    I think I see the problem...

    You have this in hover:
            Dira := Fpin
    

    This is forcing your I/O pin for the 3202 low and giving you zero readings...

    Good catch. I saw that and other considered the individual pin.

    @jcfjr Make sure and check out the link in Rayman's signature. I learned a lot from Rayman's site and from his forum posts.
  • RaymanRayman Posts: 13,805
    you are setting DIRA to 11

    11 in binary is %1011

    This is turning on pins 0, 1 and 3 to whatever value is in OUTA for those bits.
    This is probably zero thereby forcing I/O pin #3 to zero and giving you zero readings
  • Rayman,
    Thank you, Thank you, Thank you. I changed my Fpin to 16, and now everything works. If I wanted to still use pin 11 to measure my frequency, without affecting the 3202, how should I state the DIRA in hover?
  • RaymanRayman Posts: 13,805
    dira:=1<<11

    or dira[11]:=1
    or dira[11]~~
  • Rayman,
    Da! I new it had to be something stupid I had done, but now it makes perfect sense what it was doing.

    Thanks to all that spent their time to help me with this project. Another lesson learned! I have now finalized my software and need to design and build the board for the new processor.
  • RaymanRayman Posts: 13,805
    Glad I was able to help.
  • What I meant to type was DIRA[Fpin] := 0, to set my frequency monitoring pin, Fpin, to input. Since this never caused a problem until I added the 3202 to pins 2,3,4....never thought to look at hover. Thanks again.
Sign In or Register to comment.