Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem between Servo and digitalWrite
28-05-2013, 07:10 PM,
#1
Sad  problem between Servo and digitalWrite
I think there is a problem (bug?) between the Servo library and the basic digitalWrite() function.
I use the IDE x.3 version with 16F2550 with bootloader 2.12.
I use digitalWrite to light a LED; and when I have the servo library in use, the duration of the light pulse is very short (It has been reported on some old threads posted in 2011).
I think the servo library take overs the digitalwrite, which will explain why the pulse is shorter than expected.
- Does someone has encountered the same problem ?
- Does someone has solved it ?
- is there couple of pins on which this restriction does not apply ? (I use pin 10 for the servo and 7 for the Led).
- Is there a solution not to use digitalWrite (I want to keep the servo library which is quite powerfull) ?
Reply
29-05-2013, 10:44 AM,
#2
RE: problem between Servo and digitalWrite
Could you try with last revision of x.4 ? I'm afraid x.3 is far too old now.



(28-05-2013, 07:10 PM)druilhe Wrote: I think there is a problem (bug?) between the Servo library and the basic digitalWrite() function.
I use the IDE x.3 version with 16F2550 with bootloader 2.12.
I use digitalWrite to light a LED; and when I have the servo library in use, the duration of the light pulse is very short (It has been reported on some old threads posted in 2011).
I think the servo library take overs the digitalwrite, which will explain why the pulse is shorter than expected.
- Does someone has encountered the same problem ?
- Does someone has solved it ?
- is there couple of pins on which this restriction does not apply ? (I use pin 10 for the servo and 7 for the Led).
- Is there a solution not to use digitalWrite (I want to keep the servo library which is quite powerfull) ?
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
31-05-2013, 06:41 PM,
#3
RE: problem between Servo and digitalWrite
Regis, I've tried the x4, but get so many errors (even on the Examples) that I have no time to investiguate. I will continue with the x3 untill the completion of my current project, which has a due date end of june.
Reply
03-06-2013, 07:38 PM,
#4
RE: problem between Servo and digitalWrite
I have download and isntalled the x4, but when compiling a very simple example:

-------------------
void setup() {
}

void loop() {
analogWrite(11, 0);
} // loop
-------------------

I got (in stdout) plenty of error messages, of which:
C:\x4-easy-rev685mod\source\main.asm:42:Error[113] Symbol not previously defined (_GetSystemClock).


I've compiled the AnalogInOut.pde example, and I get the same errors.

Probabely something wrong with my W8 setup.
Reply
03-06-2013, 07:57 PM,
#5
RE: problem between Servo and digitalWrite
Avrin has just released a new package for Windows :
http://forum.pinguino.cc/showthread.php?tid=3951
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
04-06-2013, 08:27 PM,
#6
RE: problem between Servo and digitalWrite
I've loaded the new x4 version, it is much better, thanks to Avrin.
I dont get the same message (AnalogWrite works fine now), BUT now I have problem with the Serial Function.
Reading the Avrin release, I see that it has been tested on the new 2J55 which has two UARTs, so I guess now we need to pass the UART number to the serial_print() routine, but there is no updated doc.
so:
- Where can I see the new doc of the serial library ?
- Has it been tested on 2550 ?

Sorry for the urgency but I have something to deliver for end of next week, and I need a version that work on 2550 with Serial and AnalogWrite (I can avoid the Servo library if needed).

I have attached the basic program, as an example (I will need to seriousely complexify it).

Thanks for your quick support.


Attached Files
.pde   drag_demo1.pde (Size: 2.44 KB / Downloads: 5)
Reply
04-06-2013, 08:52 PM,
#7
RE: problem between Servo and digitalWrite
There's likely serial1.xxx and serial2.xxx (or maybe serial0.xxx).
Have a look at the pdl and so on files and the C source to figure it out.

John
Reply
05-06-2013, 08:56 AM,
#8
RE: problem between Servo and digitalWrite
To be fast and efficient :
1/ Serial.getkey() -> Serial.getKey()
2/ Serial.print() -> Serial.printf()
Why this 2nd point ?
1/ You already use Serial.printf so it won't increase dramatically your code size
2/ Serial.print has a bug
Hope it works for you.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
05-06-2013, 09:31 PM,
#9
RE: problem between Servo and digitalWrite
Thanks Regis and all.
Com and Analog work on x4.
I can continue.
I will investigate the servo issue later.
Reply
16-11-2013, 02:35 PM, (This post was last modified: 16-11-2013, 05:13 PM by regis.)
#10
Smile  [SOLVED] problem between Servo and digitalWrite
(05-06-2013, 09:31 PM)druilhe Wrote: Thanks Regis and all.
Com and Analog work on x4.
I can continue.
I will investigate the servo issue later.
Hello druilhe, you were right, there was a problem in servo library that reseted all pin ports in a PIC when a servo was in use. The problem was corrected and the newest library doesn't contain that error anymore.
You can update your svn copy and test it (x.4 rel. 940 or higher) http://code.google.com/p/pinguino32/sour...se/ide/x.4 .
If you detect any other problem just leave a message.

Thanks for your interest.
"If you think you can do a thing or think you can't do a thing, you're right." Henry Ford
My blog: http://linuxdroids.wordpress.com
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)