​ ​ ​ ​ Help please with 20M2 inputs - Page 2
Page 2 of 6 FirstFirst 1 2 3 4 ... LastLast
Results 11 to 20 of 53

Thread: Help please with 20M2 inputs

  1. #11
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    24,343

    Default

    Quote Originally Posted by oldbloke View Post
    do : loop until C.7 = 1
    PinC.7, not C.7

    C.7 is the name of the pin you are using but pinC.7 is what delivers the input value on the pin.

  2. #12

    Default

    Hi. Thanks for your input. I must admit that I haven't tried the simulator. I'm assuming it emulates the PicAxe board running a code. This would certainly be good to see if any of the code is failing to perform its intended task. I will give it a go.



    Quote Originally Posted by The bear View Post
    Hi oldbloke,
    Are you using the simulator in PE6? No soldering required. Its quick & easy.

    Regards bear..

  3. #13

    Default

    Ah, okay, thanks.

    So...
    Code:
    test:
    do : loop until pinC.7 = 1
    high B.6; turn on lamp
    pause 1000
    low B.6
    end
    Quote Originally Posted by hippy View Post
    PinC.7, not C.7

    C.7 is the name of the pin you are using but pinC.7 is what delivers the input value on the pin.

  4. #14

    Default

    Right, so I needn't worry about having resistors in the input circuits???

    Looking at the code you have suggested. I had a read of this in the manual and failed to understand most of it. However, I did find some bits. Are you suggesting that the inputs I am using may already be set 'high' and that's why the code does not respond to an open circuit on the input? Does the SerTxd command clear that? I'm right at the edge of my knowledge here.
    Thanks again.


    Quote Originally Posted by hippy View Post
    The board you have seems to be an AXE118. If so then the pins on the left are input pins with V+ next to them. Shorting the two together should take the input high. The pull-down resistors are in the 'thin black strip' component on the left; that's a Single In-Line resistor package (SIL).

    Perhaps try this code ...

    Code:
    #Picaxe 20M2
    #Terminal 4800
    Do
      If pinC.7 = 0 Then
        SerTxd( "Pin C.7 is low (0)", CR, LF )
        Do : Loop While PinC.7 = 0
      Else
        SerTxd( "Pin C.7 is high (1)", CR, LF )
        Do : Loop While PinC.7 = 1
      End If
    Loop

  5. #15
    Technical Support
    Join Date
    Jan 1970
    Location
    Bath,UK
    Posts
    6,459
    Blog Entries
    1

    Default

    As long as you have soldered the SIL resistor (the long thin black thing) the correct way around (the dot at the correct end) then all the inputs now have a 10k pull down resistor fitted (thanks to the SIL resistor - it's basically lots of resistors in one long package).
    PICAXE Technical Support

  6. #16
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    24,343

    Default

    Quote Originally Posted by oldbloke View Post
    Looking at the code you have suggested. I had a read of this in the manual and failed to understand most of it.
    Basically it will report what levels are detected on the input, which should change whenever you press or release the button connected to the input pin.

    If things are working as expected then it should show "Pin C.7 is low (0)" when the program first starts, show "Pin C.7 is high (1)" when the button is pressed, and "Pin C.7 is low (0)" when it is released.

    What results do you get ?

    If the result is always "Pin C.7 is high (1)" that suggests that your button may be permanently closed. That would most likely be a result of having wired the wrong legs of the button if it's a 6mm square button with four legs.

    If it's "Pin C.7 is low (0)" then it may also be a miswiring of the button or the button may not be connected to the C.7 input point.

  7. #17

    Default

    Thanks. I will check that it's the right way around. Which end should the dot be?
    (I built this board a few years ago but have not needed the inputs until now.)


    Quote Originally Posted by Technical View Post
    As long as you have soldered the SIL resistor (the long thin black thing) the correct way around (the dot at the correct end) then all the inputs now have a 10k pull down resistor fitted (thanks to the SIL resistor - it's basically lots of resistors in one long package).

  8. #18

    Default

    Right, so this should provide feedback to my computer screen? I will give it a go.
    I'm struggling a bit because the PicAxe software is on an old netbook and not my computer and the PicAxe chip is in my shed. The whole process takes a lot longer
    Update soon.
    Thanks again.


    Quote Originally Posted by hippy View Post
    Basically it will report what levels are detected on the input, which should change whenever you press or release the button connected to the input pin.

    If things are working as expected then it should show "Pin C.7 is low (0)" when the program first starts, show "Pin C.7 is high (1)" when the button is pressed, and "Pin C.7 is low (0)" when it is released.

    What results do you get ?

    If the result is always "Pin C.7 is high (1)" that suggests that your button may be permanently closed. That would most likely be a result of having wired the wrong legs of the button if it's a 6mm square button with four legs.

    If it's "Pin C.7 is low (0)" then it may also be a miswiring of the button or the button may not be connected to the C.7 input point.

  9. #19
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    24,343

    Default

    Quote Originally Posted by oldbloke View Post
    I will check that it's the right way around. Which end should the dot be?
    The dot is the resistor package's common connector so should be 0V.

    Code:
     .-.-.-.-.-.-.-.
     | | | | | | | |
     R R R R R R R |
     | | | | | | | |<-- Dotted leg
    I don't have a board to hand to say which way round that is but if you turn the board over the 0V on the PICAXE, download socket and 0V power input should go to the resistor package pin which should have the dot.

    Even if the resistor package is the wrong way round it should still work with just the one button connected.

    What results do you get with the test program in post #10 ? That will help indicate what is wrong.

  10. #20

    Default Many thanks

    Well, thanks to everyone for your help. SUCCESS!

    The problem appears to have arisen from the syntax. I downloaded a simple bit of test code based on the advice given and the input appears to work. I tested it with two other inputs and they now work too.
    So, here we go, I can now move my project onwards. Also now considering buying another PicAxe pic and devising some other control project.
    Many thanks!

Tags for this Thread

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
  •