​ ​ ​ ​ Read ADC Problem
Results 1 to 5 of 5

Thread: Read ADC Problem

  1. #1
    New Member
    Join Date
    Apr 2017
    Location
    Australia
    Posts
    8

    Default Read ADC Problem

    I'm a pleb so i use the visual programming BASIC but if you guys could have a look it would be great.
    I am experiancing a problem where even though the ADC variable would be <65 the program still runs, the only way that I can get the program to physically work is if i have the programming cord connected to the picaxe and my laptop whilst im using it.
    Itteration 7.PNG

  2. #2
    Senior Member
    Join Date
    Aug 2011
    Location
    US
    Posts
    525

    Default

    Quote Originally Posted by OneofLast View Post
    I'm a pleb so i use the visual programming BASIC but if you guys could have a look it would be great.
    I am experiancing a problem where even though the ADC variable would be <65 the program still runs, the only way that I can get the program to physically work is if i have the programming cord connected to the picaxe and my laptop whilst im using it.
    Itteration 7.PNG
    I've never dreamed of trying to program that way, and I'm really bad at code. But. I'll take a shot. The value of C.4 determines what the entire program will do, and it doesn't even begin to get an ADC reading at start-up. It's in a nebulous state until you tell it to do something (go high, go low, or be an input and take an ADC reading).

    Hippy, white telephone please. Paging hippy. I know, totally worthless attempt at humor, hippy will be along very rapidly, as will others, and you will be on your way!

    Also, make sure that your grounds are electrically common (connected together intimately). The ADC function is very sensitive, and if it is only getting electrical ground through the programming jack of the AXE027 (or wherever), the ADC results will vary wildly.
    Last edited by rq3; 09-08-2018 at 01:51.

  3. #3
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    24,438

    Default

    Quote Originally Posted by OneofLast View Post
    I am experiancing a problem where even though the ADC variable would be <65 the program still runs, the only way that I can get the program to physically work is if i have the programming cord connected to the picaxe and my laptop whilst im using it.
    That seems to suggest that the download cable is affecting the ADC readings. That shouldn't happen when using an AXE027 but there may be other issues.

    The best approach to resolving this issue would be to write a Basic program which can be started with or without the AXE027 plugged in, then report what the ADC readings were in both cases once the AXE027 is connected-

    Code:
    Gosub ReadTheAdc
    b1 = b0 ; Min reading
    b2 = b0 ; Initial reading
    b3 = b0 ; Max reading
    
    For b4 = 1 To 20
      Gosub ReadTheAdc
      b1 = b1 Max b0 ; Max means lowest
      b3 = b3 Min b0 ; Min means highest
      Pause 250  
    Next
    
    Do
      SerTxd( #b1, TAB, #b2, TAB, #b3, CR, LF )
      Pause 1000
    Loop
    
    ReadTheAdc:
      ReadAdc C.4, b0
      Return
    Download that and run it. Note the output.

    Turn the PICAXE power off. Disconnect the AXE027. Turn power back on. After 10 seconds plug the AXE027 back in. Note the output again.

    Let us know what readings you get.

    If you can let us know which PICAXE you are using, what your full circuit is, that may help diagnose things.

  4. #4
    Senior Member
    Join Date
    Feb 2010
    Location
    Don't Mess With My Texas!
    Posts
    2,571
    Blog Entries
    7

    Default

    This issue also traces back to the lack of a common ground, too.

  5. #5
    Senior Member
    Join Date
    Jan 1970
    Location
    Perth, Western Australia
    Posts
    4,482

    Default

    Do you have the download circuit resistors permanently connected to your PICAXE?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •