12f675_fuse_about_to_blow!


Closed Thread
Results 1 to 40 of 929

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default

    Hi,
    You say that if the button is pressed one time it should run the first loop - no problem there. But how fast should you need "double-click" or "tripple-click" it in order to run the second or third loop instead of the first one? Or should it run the first loop as soon as it sees a button press and THEN wait for the button the be pressed again?

    With the count command but you need to understand that it counts for a certain amount of time during which nothing else will get executed, once that time has passed (10000ms in your case) the code will continue.

    So, your idea was on the right track but the implementation had a couple of problems as explained in my previous message. Here's ONE aproach to the single, double, triple-click solution but remember that it might not work in reallity due to the switch bouncing as described before.

    Let's say your button pulls the input low when pushed.
    Code:
    B_P_C VAR BYTE
    
    WaitForButton:
      If GPIO.5 = 1 THEN GOTO WaitForButton 'Button is not pressed, go back and check again
      PAUSE 10           			'Wait a little while for the contact bouncing to die
    
    WaitForRelease:
      If GPIO = 0 THEN GOTO WaitForRelease  'Loop here until button is relased
    
      COUNT GPIO.5, 1000, B_P_C             'Count number of presses for during one second
    
      IF B_P_C = 0 THEN GOTO FirstLoop      'Remember, we had to press the button once to get here.
      If B_P_C = 1 THEN GOTO SecondLoop
      If B_P_C = 2 THEN GOTO ThirdLoop      'First one press, then two more as counted by the COUNT-command.
    
    Goto WaitForButton                      'Start over if number of presses is more than 3
    
    FirstLoop:
    'Your code here
    Goto WaitForButton
    
    SecondLoop
    'Your code here
    Goto WaitForButton
    
    ThirdLoop:
    'Your code here
    Goto WaitForButton
    
    END
    Now, wire it up, compile the code, program the chip and GIVE IT A TRY! ;-) If there's still "basic" stuff that you don't understand then you need to back up and get that sorted first or you will just be creating more problems for yourself. Perhaps we jumped to the LOOKUP and COUNT commands etc a little too soon(?).

    /Henrik.

  2. #2
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Henrik first of all a big thank you for giving your time to help me along (and everyone else too of course).
    If there's still "basic" stuff that you don't understand then you need to back up and get that sorted first or you will just be creating more problems for yourself. Perhaps we jumped to the LOOKUP and COUNT commands etc a little too soon(?).
    I agree, I do need to back up and go over some of the basics we've covered, like you say running before you can walk with programming will only compound problems later on.

    I think I need to write lots of short programs using the basics and do enough of them to really drive it home.

    That said, I do understand the basic principle of the COUNT command and it's timing component also with the LOOKUP command.

    When you think that trying to use C and assembler I hadn't even managed to switch an LED on! I've come a long since joining this forum and using PB in the last few weeks thanks to you all, there's absolutely no doubt that this in the language to use!

    So no, time to build this circuit (I need to make something work) and I'm sure I'll still have plenty of questions for you about the basics still, so you're not of the hook quite yet....;-)

    David

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default

    So no, time to build this circuit (I need to make something work) and I'm sure I'll still have plenty of questions for you about the basics still, so you're not of the hook quite yet....;-)
    No problems, we're all here to help.

  4. #4
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi everyone.

    I haven't posted for a wee while but have been busy reading and building my first two circuits.

    The first is a 12F683 driving four LED's in a binary pattern 0-9 as per the thread (I've also added a nice little Night_Rider effect). I must say, although simple in what I've achieved, when those four LED's run up that binary pattern it was a real thrill, amazing.

    The second circuit marrying the binary counting PIC to the BCD decoder driver then seven segment display is about half way built ( I'm quietly confident about this one fingers x'd).

    Once again, thanks for all your help on here. I really wouldn't have got this far without it.

    I'll be back when the second circuit is completed (early part of next week).

    Hope you're all keeping well.

    David

  5. #5
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default Update

    Hi Everyone.

    Just to let you know I've got a a working circuit!!!!! Yippee.

    It's a 12F683 into a SN74LS47N display driver and a 1" seven segment display counting up to nine.The PIC output also switches four transistors with collector LED's for a binary output count as well.

    Simple stuff for you boys I'm sure but I'm chuffed to bits right now.

    Not sure where to go or what to do next (any ideas welcome).

    Thanks for your help as ever.

    Dave

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    COOL!!!! You are moving right along.

    Here is an idea. Setup a hardware timmer to change the display once per second.
    Last edited by mackrackit; - 19th March 2010 at 23:12.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Here is an idea. Setup a hardware timmer to change the display once per second.
    Hi mackrackit

    Are we saying for example to use the trimmer pot on the PICkit1 to alter the display speed ADC? (ADCIN).

    I'm seriously considering buying the the full program version by the way (I'm just trying to convince myself I'm clever enough to figure out how to use / make the most of it...lol).

    Really enjoying it though (headaches aside ;-))

    Dave
    Last edited by LEDave; - 20th March 2010 at 00:12.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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