PDA

View Full Version : Make me some code..



xobx
- 11th September 2007, 16:35
This is my current circuit

http://img114.imageshack.us/img114/5695/dfgdfgfgfmg0.jpg

Can you make a code like this (in PICBASIC PRO):

When you click the button a timer starts and when you push it again it stops, and after that the LED blinks with "your time"..


Can anyone do this?

Acetronics2
- 11th September 2007, 17:59
My one and only serious Question ...

How much do you give for that ???

Alain

Melanie
- 11th September 2007, 18:18
I'd pay money to have somebody write code just to turn that LED on... (never mind anything else - assuming it's a standard LED)...

Acetronics2
- 11th September 2007, 19:38
Hi, Mel

That looks too much like the intelligent automobile screen wiper timer ...

Alain

xobx
- 11th September 2007, 20:44
I just want some example code to understand how the timer works, but i quess i haft to figure it out myself..

RussMartin
- 11th September 2007, 20:45
I may be wrong, but . . .

. . . I don't think that the LED will ever light up with any program!

SteveB
- 11th September 2007, 22:01
...Can anyone do this?

I guess the consensus is: NO, nobody can, even if they were willing to do it.:)

SteveB
- 11th September 2007, 22:21
When you click the button a timer starts and when you push it again it stops, and after that the LED blinks with "your time"..


As for this, there are an amazing number of examples for applications like this on the forum, as well as MeLabs own website, and the web in general.

I seriously doubt someone is going to be kind enough to write the code for you out of pure generosity and goodwill. That’s not to say no one will be helpful. Do a little research and come back with more specific questions. The help you reap will be proportional to effort you sow.

SteveB

BobK
- 12th September 2007, 00:48
Hi,

Russ is right about the LED. You are showing it backwards. Steve B is right also. There are more than enough examples of timers, blinking LEDs, and start/stop programs on this forum that if you sat down and organized them all, you would have a book on beginning to work with PICs. If you are looking for the quick fix, it ain't happening here. We will all be glad to offer advice once you have made some effort to try programming. Also I think you should connect your push button to the ground side of the circuit and make the resistor a pullup instead of pull down. (Nothing personal just a preference. This way you won't have to program the pin in an extra step.)

Go to CODE EXAMPLES and SCHEMATICS to start your search.

Good luck. When you get stuck, then ask!

BobK

NF9Ω
- 12th September 2007, 09:19
I can try. No timer use


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

Melanie
- 12th September 2007, 09:33
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...

Rob
- 12th September 2007, 09:45
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!

NF9Ω
- 12th September 2007, 10:21
just simply illuminate the LED as wired in that schematic...


Oh. BobK is right.
LED will never illuminate according to circuit.

Acetronics2
- 12th September 2007, 10:27
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

mackrackit
- 12th September 2007, 12:46
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/showthread.php?t=6247&highlight=timers

All I had to do was search the forum for "timers".

Melanie
- 12th September 2007, 12:46
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!").

mvs_sarma
- 12th September 2007, 13:13
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.

Acetronics2
- 12th September 2007, 13:20
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 ...

Wilson
- 12th September 2007, 13:33
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

T.Jackson
- 12th September 2007, 13:37
lol - Short of reinventing the diode, that's impossible.

keithdoxey
- 12th September 2007, 15:03
The schematic had the diodes on the bridge rectifier for the power supply connected wrong.

Sounds like my first attempt at building a bridge rectifier when I was about 11 years old.

What I actually constructed was a "ring rectifier" with all the diodes pointing in a circle. There was an almighty bang when I turned the power on and my diodes were no more. Didnt make that mistake again :)

Kamikaze47
- 12th September 2007, 18:37
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!

peterdeco1
- 12th September 2007, 19:26
I think you just made $20.

SteveB
- 12th September 2007, 20:08
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...


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. :D

T.Jackson
- 13th September 2007, 10:56
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

Meriachee
- 18th September 2007, 23:34
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.

Kamikaze47
- 19th September 2007, 05:17
My solution wasn't "significant modification"... It was 1 cut of 1 wire :)

keithdoxey
- 19th September 2007, 08:45
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

Kamikaze47
- 19th September 2007, 10:14
I wasnt saying it met the "contest" criteria, I was just pointing out that it didnt require "significant modification".

T.Jackson
- 20th September 2007, 05:16
New game - I'll pay AUS $25 to the person who can come up with the best DC to DC converter design. It should be low in cost, capable of producing at least 10mA @7V (~70mW of power) from a 5V source. Additional, desirable criteria in the design would include: compactness, protection, low component count, efficient, testable & robust.


<b>The Contest</b>
<ul>
<li> Submit in this thread, a workable, readable circuit diagram</li>
<li> It must be your own original work</li>
<li> You may submit ONE design only (no amendments allowed)</li>
<li> The design can't use a µcontroller or discrete ICs</li>
<li> A detailed description on how your design works would be beneficial</li>
<li> All entries must be submitted by the 31st of October</li>
<li> The Winner will be announced in early November </li>
</ul>
Oh! - and feedback from people on the entries will be highly regarded, and also possibly used in helping to identify the winner, so don't hold back!

Trent Jackson

BrianT
- 20th September 2007, 07:01
Have a look at

http://www.romanblack.com/

Cheers
Brian

nomad
- 20th September 2007, 07:40
What in software would create a collapsing field? if there was a relay coil across that led It can light.. not STAY lit, but light..

mvs_sarma
- 20th September 2007, 07:53
New game - I'll pay AUS $25 to the person who can come up with the best DC to DC converter design. It should be low in cost, capable of producing at least 10mA @7V (~70mW of power) from a 5V source. Additional, desirable criteria in the design would include: compactness, protection, low component count, efficient, testable & robust.


<b>The Contest</b>
<ul>
<li> Submit in this thread, a workable, readable circuit diagram</li>
<li> It must be your own original work</li>
<li> You may submit ONE design only (no amendments allowed)</li>
<li> The design can't use a µcontroller or discrete ICs</li>
<li> A detailed description on how your design works would be beneficial</li>
<li> All entries must be submitted by the 31st of October</li>
<li> The Winner will be announced in early November </li>
</ul>
Oh! - and feedback from people on the entries will be highly regarded, and also possibly used in helping to identify the winner, so don't hold back!

Trent Jackson

Most probably one could sell his or her own design at much higher cost than surrender for a Aus $20/-.

Acetronics2
- 22nd September 2007, 09:50
New game - I'll pay AUS $25 to the person who can come up with the best DC to DC converter design. It should be low in cost, capable of producing at least 10mA @7V (~70mW of power) from a 5V source. Additional, desirable criteria in the design would include: compactness, protection, low component count, efficient, testable & robust.


<b>The Contest</b>
<ul>
<li> Submit in this thread, a workable, readable circuit diagram</li>
<li> It must be your own original work</li>
<li> You may submit ONE design only (no amendments allowed)</li>
<li> The design can't use a µcontroller or discrete ICs</li>
<li> A detailed description on how your design works would be beneficial</li>
<li> All entries must be submitted by the 31st of October</li>
<li> The Winner will be announced in early November </li>
</ul>
Oh! - and feedback from people on the entries will be highly regarded, and also possibly used in helping to identify the winner, so don't hold back!

Trent Jackson

Hi, trent

Just use your OSC output to drive a common 1 transistor voltage doubler ... ( just need 1 NPN, 1 PNP, 3 resistor, 2 diodes, 2 capacitors )

Alain

PS : 25 $ for that ... ??? where did you learn electronics ????????????????????????????????

mister_e
- 22nd September 2007, 11:35
mpfff, there's a load of missing informations to base something like a design around the previous requirement.

Regulated or not?
isolated or not?
Protection??? which?
Expected Output voltage?

etc etc etc.

25$ :eek: I don't think i can do something really reliable in less than 15 minutes.. or i'll lost money... as if i really need to lost anymore now ;)

Maybe i should read the whole post again ?

T.Jackson
- 22nd September 2007, 12:24
Hi, trent

Just use your OSC output to drive a common 1 transistor voltage doubler ... ( just need 1 NPN, 1 PNP, 3 resistor, 2 diodes, 2 capacitors )

Alain

PS : 25 $ for that ... ??? where did you learn electronics ????????????????????????????????

Thank you for your contribution, Alain. Some supporting documentation on your acclaimed working circuit would further improve your chances of winning.

Trent Jackson

T.Jackson
- 22nd September 2007, 12:26
mpfff, there's a load of missing informations to base something like a design around the previous requirement.

Regulated or not?
isolated or not?
Protection??? which?
Expected Output voltage?

etc etc etc.

25$ :eek: I don't think i can do something really reliable in less than 15 minutes.. or i'll lost money... as if i really need to lost anymore now ;)

Maybe i should read the whole post again ?

Well, don't bother entering the competition then if you can't find the motivation for it - as simple as that.

T.Jackson
- 22nd September 2007, 12:46
Ideally your entry will also include some firm documentation to support your idea. Some of the criteria that I'd like to see embedded in this document include ....

1. Statement of circuit scope i.e. (description, what it can do, constraints etc ...)
2. Specifications (rated output etc..)
3. Flow of events (how the circuit ticks)
4. Calculations, explanations i.e. (how did you arrive at certain values for components)
5. Any closing arguments that you may wish to add

*(2-3)pgs tops.

Trent Jackson

Acetronics2
- 22nd September 2007, 12:46
Thank you for your contribution, Alain. Some supporting documentation on your acclaimed working circuit would further improve your chances of winning.

Trent Jackson

Hi, Trent ...

You're joking, I do hope ....

Alain

T.Jackson
- 22nd September 2007, 13:19
I couldn't be anymore real, serious & genuine about it. This is an official contest to see who can come up with the best low-cost DC to DC converter design.

mvs_sarma
- 22nd September 2007, 14:27
I couldn't be anymore real, serious & genuine about it. This is an official contest to see who can come up with the best low-cost DC to DC converter design.

i WONDER WHAT IS OFFICIAL AND HOW IT IS OFFICIAL FOR A WEBSITE, when the OP is not the adminstrator?

whether now a days this website is permitting business on their site by anyone.