View previous topic :: View next topic |
Author |
Message |
aliaj00
Joined: 11 May 2011 Posts: 24
|
|
Posted: Sat May 14, 2011 7:00 pm |
|
|
dont know how to attach screenshot here |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat May 14, 2011 7:28 pm |
|
|
Go to a free image hosting service such as http://www.imageshack.com
and post it there. Then post the link here. |
|
|
aliaj00
Joined: 11 May 2011 Posts: 24
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun May 15, 2011 12:27 pm |
|
|
Post your schematic. |
|
|
aliaj00
Joined: 11 May 2011 Posts: 24
|
|
Posted: Mon May 16, 2011 1:33 am |
|
|
It is just the pic debugger with the 16F887 on it. and on RB1 RB3 there are the darlington with 500 Ohm resistance on the base. I didn't made a schematic for it as it has fewer than 10 Elements. |
|
|
aliaj00
Joined: 11 May 2011 Posts: 24
|
|
Posted: Mon May 16, 2011 2:58 am |
|
|
Hi PCM programmer,
how can i insert a rs232 into the code to change the parameters but not to loop through it in the while statement, as i will be forced to enter an answer each time.
BR's
shpetim Aliaj |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19506
|
|
Posted: Mon May 16, 2011 4:12 am |
|
|
Basic technique. Two 'modes' of operation.
'Normal' mode. Sit in your loop, and at one point do a 'kbhit'.
If this is true, read the single character from the serial. Then have a 'decision', so if (for example), the character 'C' is there, you switch to 'config' mode.
Then send a little prompt for the data you want, and read the return. With a bit of ingenuity (again kbhit, and a timer), you can have it that if no reply is seen in say 30 seconds, the code automatically returns to 'normal' mode.
On your circuit, what are the darlington's actually driving?. Is it inductive?. If so, what circuitry have you got to trap the energy stored in the inductor, when the transistors switch off?.
Best Wishes |
|
|
aliaj00
Joined: 11 May 2011 Posts: 24
|
|
Posted: Mon May 16, 2011 6:55 am |
|
|
the darlington are 2SD2390 each with 10 AMP of load or more. i attached the metallic radiator to them and also a cooler on each one of them as the heat generated was burning them "with only metallic radiator". i have tried with all loads, pure heater from old oven :P, Big COIL 2.5MM2 100 turns etc to test it. they have a diode from what i remember. i am not sure need to check. |
|
|
aliaj00
Joined: 11 May 2011 Posts: 24
|
|
Posted: Mon May 16, 2011 6:56 am |
|
|
i have tested in the 5.06Khz to 32 khz |
|
|
aliaj00
Joined: 11 May 2011 Posts: 24
|
|
Posted: Mon May 16, 2011 6:59 am |
|
|
can i put a push button on it and generate a interrupt so when i want to update the timing i can trigger the rs232 code and than to have it running without the rs232 routine.
BR's
Shpetim Aliaj |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19506
|
|
Posted: Mon May 16, 2011 7:30 am |
|
|
No point in using an interrupt. Just have one instruction in your loop, testing if the input pin is in the 'active' state. If it is, switch to the config mode.
This is exactly like 'bootloader' code, where as the chip wakes up, an input pin is tested, and if it is in the active state, the code switches to the bootloader. Zero point (and several potential problems), trying to use an interrupt for this. Much simpler just to poll the pin.
Best Wishes |
|
|
aliaj00
Joined: 11 May 2011 Posts: 24
|
|
Posted: Mon May 16, 2011 7:43 am |
|
|
thanks a lot,
i am just new with the pics after PC programming, networking and electronic stuff.
PS. by the way do you have a code snippet for this. |
|
|
aliaj00
Joined: 11 May 2011 Posts: 24
|
|
Posted: Tue May 17, 2011 5:56 am |
|
|
i will try to put a bc557 and an irfp31n50l as the driver as it have 30AMP and use the bc557 as phase corrector. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19506
|
|
Posted: Tue May 17, 2011 6:55 am |
|
|
On the question of 'code snippet', not really. This is so basic, that there isn't much to show!...
Typical thing would be to have a button connected to a pin (say B2), pulling it to ground. Then have a pull-up on this pin (either use the internal pull-ups, or a resistor).
Then just organise your code as:
Code: |
do {
//Your main loop code here
if (input(PIN_B2)==0) {
//If driving hardware, switch it to the idle state here
setup(); //call the setup routine
//switch drivers back to run mode - with the new settings
}
while (TRUE);
|
Then your main code runs, _until_ the button pulls the line low.
When it does, make sure you set your hardware to a 'safe idle' state, and then call your setup routine.
Nothing is called, till the line goes low, so the overhead, is just the single input test instruction.
Best Wishes |
|
|
aliaj00
Joined: 11 May 2011 Posts: 24
|
|
Posted: Tue May 17, 2011 10:31 am |
|
|
thanks a lot
i will do it.
i tested with the bc557 and irfp31n50l and it seems to work not much measuring but at least it still not burned. i got an 2n3440 and will try it with the irfp31n50l. maybe it has better response time. |
|
|
|