Loading ...
Sorry, an error occurred while loading the content.

Re: Simple Progam - Little Assistance

Expand Messages
  • sstandfast
    ... switch and an if statement to work. I may have popped my pic. Simple test to check your pic is to blink an LED. Just connect the cathode end of the LED
    Message 1 of 10 , Feb 1, 2007
    • 0 Attachment
      --- In jallist@yahoogroups.com, Rasterman <rasterman101@...> wrote:
      >
      > Did not work. I am going to keep playing with it till I get a
      switch and an if statement to work. I may have popped my pic.

      Simple test to check your pic is to blink an LED. Just connect the
      cathode end of the LED (the side with the flat spot) to the PIC.
      Then connect the anode to a 330R resistor. Finally connect the other
      end of the resistor to +5V. Then write a program that toggles the
      state of the output pin. An example would be:

      include 16f628_10
      include jpic
      include jdelay

      pin_a0_direction = output

      var bit dummy = false

      forever loop
      pin_a0 = dummy
      dummy = ! dummy
      delay_1s
      end loop

      If this program doesn't pass then you can check out hardware issues;
      i.e. power and gnd applied to correct pins (remember ALL pwr and gnd
      pins need to be connected), Xtal in right place, MCLR pulled up to
      +5V.

      If you pass the Blink-an-LED test then you can move on to a simple
      button.

      include 16f628_10
      include jpic
      include jdelay

      pin_a0_direction = output
      pin_b0_direction = input

      var bit button is pin_b0
      var bit LED is pin_a0
      var bit dummy = false

      LED = dummy

      forever loop

      if ! button then
      LED = dummy
      dummy = ! dummy
      delay_1ms(100)
      while ! button loop end loop
      end if

      end loop

      This code assumes that pin_b0 is pulled up via a resistor and the
      button pulls the pin low when depressed. Once you get this program
      to work you can modify it to output the pattern you want. Just keep
      the delay and while loops in there, they are for switch debounce.

      Sorry if the post is over-simplified, no idea where your PIC skills
      are at. Hope this helps get you going.

      Shawn
    • Patrick Froucht
      Creek, Add this line after the include(s) to set the port A inputs as digital inputs. Otherwise, trey are not considered by JAL. Otherwise A_0 is considered as
      Message 2 of 10 , Feb 1, 2007
      • 0 Attachment
        Creek,

        Add this line after the include(s) to set the port A inputs as digital
        inputs. Otherwise, trey are not considered by JAL. Otherwise A_0 is
        considered as one input of a comparator.

        var volatile byte CMCON at 0x1F = 0x07

        Enjoy JAL

        Patrick

        Creek a écrit :
        > -- Would anyone happen to know why this is not working?
        > -- Its suppose to take a switch at a0 and if it equals, do something else.
        >
        > include 16f628_10
        > include jlib
        >
        > port_b_direction = all_output -- tell port b that they are all outputs
        > pin_a0_direction = input -- set up a0 for the (switch)
        >
        >
        > var byte x = 0b_0000_0001 -- start with this number
        >
        > forever loop
        > port_b = ! x -- invert output
        > delay_50ms( 2 ) -- delay 50ms
        > x = x << 1 -- shift left the number
        >
        > if pin_a0 == high then -- if a0==high then do this (switch)
        > x = 0b_0001_0001 -- number to output
        > port_b = ! x -- out number
        > delay_100ms( 2 ) -- delay 100ms
        > x = 0b_1000_1000 -- number to output
        > port_b = ! x -- out number
        > delay_100ms( 2 ) -- delay 100ms
        > end if
        >
        > if x == 0b_0000_0000 then -- if equals, start over
        > x = 0b_0000_0001 -- start with this number
        > end if
        >
        > end loop
        >
        >
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
      • Augusto Yipmantin
        Hi all, I need to build a little resonator and the original has a little coil labeled: uH 22 - K It means the coil has a 22 microhenries value? What does mean
        Message 3 of 10 , Feb 1, 2007
        • 0 Attachment
          Hi all,



          I need to build a little resonator and the original has a little coil
          labeled: uH 22 - K

          It means the coil has a 22 microhenries value? What does mean the "K"
          letter?

          Many thanks in advance,



          Augusto, OA4CVT



          [Non-text portions of this message have been removed]
        • Wouter van Ooijen
          ... From: jallist@yahoogroups.com [mailto:jallist@yahoogroups.com] On Behalf Of Augusto Yipmantin Sent: Thursday, February 01, 2007 6:37 PM To:
          Message 4 of 10 , Feb 1, 2007
          • 0 Attachment
            -----Original Message-----
            From: jallist@yahoogroups.com [mailto:jallist@yahoogroups.com] On Behalf
            Of Augusto Yipmantin
            Sent: Thursday, February 01, 2007 6:37 PM
            To: jallist@yahoogroups.com
            Subject: [jallist] off topic help please



            Hi all,

            I need to build a little resonator and the original has a little coil
            labeled: uH 22 - K

            It means the coil has a 22 microhenries value? What does mean the "K"
            letter?

            Many thanks in advance,

            Augusto, OA4CVT

            [Non-text portions of this message have been removed]







            [Non-text portions of this message have been removed]
          • Rasterman
            It worked. Thanks. Patrick Froucht wrote: Creek, Add this line after the include(s) to set the port A
            Message 5 of 10 , Feb 1, 2007
            • 0 Attachment
              It worked. Thanks.

              Patrick Froucht <p.froucht@...> wrote: Creek,

              Add this line after the include(s) to set the port A inputs as digital
              inputs. Otherwise, trey are not considered by JAL. Otherwise A_0 is
              considered as one input of a comparator.

              var volatile byte CMCON at 0x1F = 0x07

              Enjoy JAL

              Patrick

              Creek a écrit :
              > -- Would anyone happen to know why this is not working?
              > -- Its suppose to take a switch at a0 and if it equals, do something else.
              >
              > include 16f628_10
              > include jlib
              >
              > port_b_direction = all_output -- tell port b that they are all outputs
              > pin_a0_direction = input -- set up a0 for the (switch)
              >
              >
              > var byte x = 0b_0000_0001 -- start with this number
              >
              > forever loop
              > port_b = ! x -- invert output
              > delay_50ms( 2 ) -- delay 50ms
              > x = x << 1 -- shift left the number
              >
              > if pin_a0 == high then -- if a0==high then do this (switch)
              > x = 0b_0001_0001 -- number to output
              > port_b = ! x -- out number
              > delay_100ms( 2 ) -- delay 100ms
              > x = 0b_1000_1000 -- number to output
              > port_b = ! x -- out number
              > delay_100ms( 2 ) -- delay 100ms
              > end if
              >
              > if x == 0b_0000_0000 then -- if equals, start over
              > x = 0b_0000_0001 -- start with this number
              > end if
              >
              > end loop
              >
              >
              >
              >
              >
              > Yahoo! Groups Links
              >
              >
              >
              >
              >






              ---------------------------------
              Any questions? Get answers on any topic at Yahoo! Answers. Try it now.

              [Non-text portions of this message have been removed]
            • gudy zopfi
              22 uH *1000 =---- 22mH ... ____________________________________________________ Tired of spam? Yahoo! Mail has the best spam protection around
              Message 6 of 10 , Feb 2, 2007
              • 0 Attachment
                22 uH *1000 =----> 22mH

                --- Augusto Yipmantin
                <augustoy@...> wrote:

                > Hi all,
                >
                >
                >
                > I need to build a little resonator and the original
                > has a little coil
                > labeled: uH 22 - K
                >
                > It means the coil has a 22 microhenries value? What
                > does mean the "K"
                > letter?
                >
                > Many thanks in advance,
                >
                >
                >
                > Augusto, OA4CVT
                >
                >
                >
                > [Non-text portions of this message have been
                > removed]
                >
                >







                ____________________________________________________
                Tired of spam? Yahoo! Mail has the best spam protection around
                http://ph.mail.yahoo.com
              Your message has been successfully submitted and would be delivered to recipients shortly.