Make me some code..


Closed Thread
Results 1 to 40 of 41

Hybrid View

  1. #1
    Join Date
    Aug 2007
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    I can try. No timer use
    Code:
    DEFINE OSC 4
    CMCON = 7
    ADCON1 = 7
    output PORTB.0
    input PORTA.4
    b0 var word
    b0 = 0
    HIGH PORTB.0
    pause 200
    
    main:   if PORTA.4 = 1 then enter
            goto main
    
    enter:        if porta.4 = 1 then enter
                
    tmecnt:    if PORTA.4 = 1 then extime
                  b0 = b0+1         
                   pause 100   ' Least count of time 100 ms
                  goto tmecnt
    
    extime:     if PORTA.4 = 1 then extime
    
    ledon:  b0 = b0 * 100
            LOW PORTB.0
            pause b0
            HIGH PORTB.0
            b0 = 0
            goto main
            end
    If code works, can i give my PayPal................ hehe
    Last edited by NF9Ω; - 12th September 2007 at 09:41. Reason: led state change
    Thought-habits can harden into character. So watch your thoughts.

    (__)

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default $10 Challenge...

    My challenge was to write a piece of code to make the LED in that schematic light... I can't see your code turning that LED on... never mind any timers or buttons, just simply illuminate the LED as wired in that schematic...

    As someone who likes to learn new things, it's worth it to me to know how to accomplish this in software (PICBasic, Proton, Assembler, C, Fortran, Cobol, Algol, whatever, I'm good for all flavours)...

    For those that want to take up the challenge... I'll save you some time and tell you that the piece of code below WON'T work...

    High PortB.0

    and neither will...

    Low PortB.0

    So... a US$10 challenge to the first person who lights the LED (a bog-standard, common or garden nothing special cheapo average LED) in that original schematic (which must remain unchanged) as shown in Post #1 above... and posts his or her working code in this thread...

  3. #3
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    94


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by Melanie View Post
    My challenge was to write a piece of code to make the LED in that schematic light... I can't see your code turning that LED on... never mind any timers or buttons, just simply illuminate the LED as wired in that schematic...

    As someone who likes to learn new things, it's worth it to me to know how to accomplish this in software (PICBasic, Proton, Assembler, C, Fortran, Cobol, Algol, whatever, I'm good for all flavours)...

    So... a US$10 challenge to the first person who lights the LED (a bog-standard, common or garden nothing special cheapo average LED) in that original schematic (which must remain unchanged) as shown in Post #1 above... and posts his or her working code in this thread...
    It's a great challenge but I think it's worth more than $10! I'll add another $10 to the pot for the person who achieves it ;-). Now it's worth $20!

  4. #4
    Join Date
    Aug 2007
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    just simply illuminate the LED as wired in that schematic...
    Oh. BobK is right.
    LED will never illuminate according to circuit.
    Thought-habits can harden into character. So watch your thoughts.

    (__)

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Talking Turn your tongue in your mouth 7 times before ....

    Hi, Everyone ...

    I Win !!!

    Just Reverse supply voltage and the Led will light ...

    Yesssss ... the Port Inputs clamp diodes Help !!!

    Thank you very much, Mel ... I'm waiting for my Bucks !!!

    Nobody told the Pic might stay Alive !!!

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    xobx,

    The demand "Make me some code" as you have seen will not get you anywhere.

    If you really want to learn, study, write some code and then ASK for help.

    Here is someplace to start http://www.picbasic.co.uk/forum/show...ghlight=timers

    All I had to do was search the forum for "timers".
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Good try Alain, but the 1N4004 across the input shorts-out the supply...

    Game is still open... (excludes supplying the +5v reverse-way round from a high-current source which smokes-out the 1N4004 first, and then the input capacitor, then destroys the PIC and finally lights the LED (which has a panel legend above it saying "now you're completely screwed!").

  8. #8
    Join Date
    Mar 2006
    Location
    Hyderabad (India)
    Posts
    123


    Did you find this post helpful? Yes | No

    Default

    Melanie is CORRECT

    the circuit is designed wrongly. Forget the micro. Even by connecting the ground at anode of LED it would not light. the LED woud have been wired otherway round. this configuration is like a protection diode across a relay coil driven by a transistor. Perhaps XOBX has to improve on his / her funda of harware design.

    YES, it will light, if by using the port pin RB0, we switch a higher voltage than +6.4V to the anode of LED.
    Last edited by mvs_sarma; - 12th September 2007 at 13:15.
    Regards,
    Sarma

  9. #9
    Join Date
    Sep 2007
    Location
    Australia
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Reminds me of an Industrial Electronics exam I sat for back in the eighties. The circuit was a pretty basic push-pull amp in which we had to write an essay what happens once power was applied.
    The schematic had the diodes on the bridge rectifier for the power supply connected wrong.
    I just wrote that 2 diodes across the 15VAC supply would blow up. I was the only one that got it right.

    Wilson

  10. #10
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi, Mel

    You've wrote it ...

    It had to make some smoke, BUT IT WORKS !!!

    Do you have some Scottish elders, to modify the rules AFTER the beginning of the Game ??? ...

    Bad looser, I Wonder, hmmmm ???

    LOL

    Alain

    PS: Note, I often saw ( some years ago ) LEDs drawn in a circle ... but drawn "reverse" connected.
    This could simplify the game ...
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  11. #11
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Post

    lol - Short of reinventing the diode, that's impossible.

  12. #12
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    Game is still open...
    How about: 'accidentally' cut the wire directly above the "16F628" in the circuit diagram, then PORTA.4=0, then PORTB.0=1, and press the button. LED=lit!

  13. #13


    Did you find this post helpful? Yes | No

    Default

    I think you just made $20.

  14. #14
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    So... a US$10 challenge to the first person who lights the LED (a bog-standard, common or garden nothing special cheapo average LED) in that original schematic (which must remain unchanged) as shown in Post #1 above... and posts his or her working code in this thread...
    Quote Originally Posted by Kamikaze47
    How about: 'accidentally' cut the wire directly above the "16F628" in the circuit diagram, then PORTA.4=0, then PORTB.0=1, and press the button. LED=lit!
    I don't think this qualifies.

  15. #15
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default Psychology

    Melanie's challenge proposal had me scratching my head for a few moments, initially thinking that it was indeed possible, after all she is an engineer and doesn't appear to joke much. Because, when someone sets such a low "wager" (only $10 in this case) - it's normally well within reach. In other words it's something that's actually possible, the low wager is chosen based on high risk analysis, the person placing the bet is in fear that there's a good chance that someone might actually win it. So to minimize their loss, in the well foreseen event that someone wins, a low wager is set in place.

    If a much higher wager was on offer, I wouldn't have spared a seconds thought. Instead using most of what I know about LEDs to very quickly dismiss it as impossible (or at least for me) I personally feel that the only way you'll get that reversed biased LED to switch on is with additional circuitry, i.e: charge pump (DC to DC converter) to raise the anode ~1.8V above cathode (assuming it's a red LED or around 2V if it's green)

    Trent Jackson

  16. #16
    Join Date
    Oct 2006
    Location
    Edmonton AB Canada
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    So that's it? Besides the fact that significant modification, if not outright destruction would be required to get the money out of Melanie, it was an interesting discussion.

  17. #17
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    My solution wasn't "significant modification"... It was 1 cut of 1 wire

  18. #18
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kamikaze47 View Post
    My solution wasn't "significant modification"... It was 1 cut of 1 wire
    Hmmmmm.... sounds like a quote from a bomb disposal technician

    However, cutting one wire changes the circuit diagram so no money for you.!!!

    PS. If you are a bomb disposal technician you might want to change your name to instill more confidence LOL
    Keith

    www.diyha.co.uk
    www.kat5.tv

Similar Threads

  1. Code doesn't work on 16F648A
    By Mr_Joe in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 1st September 2018, 22:09
  2. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 22:31
  3. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  4. Minimizing code space
    By Tobias in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th May 2009, 07:25
  5. Can someone help me make a code for this:
    By joseph in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 18th May 2009, 22:03

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