Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AnalogWriteMega Example Not Working!
04-02-2017, 06:35 PM,
#1
AnalogWriteMega Example Not Working!
Hi  Everybody,
Unfortunately I have found the example of (AnalogWriteMega.pde) not working, all LEDs were always off.
For your information, my 8 bit Pinguino 4550 is working on Win XP SP3 - 32 bit.
I tried already to compile and upload this example by IDE v12 and rev.999 several times, it compiles and uploads successfully but without any sign of functioning from the Pinguino! .. I am wondering what could be the reason?
Aldeen19
Reply
05-02-2017, 04:00 AM,
#2
RE: AnalogWriteMega Example Not Working!
(04-02-2017, 06:35 PM)Aldeen19 Wrote: Hi  Everybody,
Unfortunately I have found the example of (AnalogWriteMega.pde) not working, all LEDs were always  off.
For your information, my 8 bit Pinguino 4550 is working on Win XP SP3 - 32 bit.
I tried already to compile and upload this example by IDE v12 and rev.999 several times, it compiles and uploads successfully but without any sign of functioning from the Pinguino! .. I am wondering what could be the reason?

aldeen,
 i just tried under v12 and this only works on pins 11 & 12 pwm.

fred
Reply
05-02-2017, 11:32 AM,
#3
RE: AnalogWriteMega Example Not Working!
derf158
(04-02-2017, 06:35 PM)Aldeen19 Wrote: Hi  Everybody,
Unfortunately I have found the example of (AnalogWriteMega.pde) not working, all LEDs were always  off.
For your information, my 8 bit Pinguino 4550 is working on Win XP SP3 - 32 bit.
I tried already to compile and upload this example by IDE v12 and rev.999 several times, it compiles and uploads successfully but without any sign of functioning from the Pinguino! .. I am wondering what could be the reason?

aldeen,
 i just tried under v12 and this only works on pins 11 & 12 pwm.

fred

Thank you Fred, so this means that analog pins of P4550 are only two (11 & 12).  I thought that analog pins are A13 through A20 as stated in the Pinguino schematic, but when I referred to the table of pins I realized that A13,A20 pins are analog inputs,  however the mentioned example is dealing with 12 analog outputs as it is actually written for Arduino Mega.
Aldeen19
Reply
05-02-2017, 01:53 PM,
#4
RE: AnalogWriteMega Example Not Working!
(05-02-2017, 11:32 AM)Aldeen19 Wrote: derf158
(04-02-2017, 06:35 PM)Aldeen19 Wrote: Hi  Everybody,
Unfortunately I have found the example of (AnalogWriteMega.pde) not working, all LEDs were always  off.
For your information, my 8 bit Pinguino 4550 is working on Win XP SP3 - 32 bit.
I tried already to compile and upload this example by IDE v12 and rev.999 several times, it compiles and uploads successfully but without any sign of functioning from the Pinguino! .. I am wondering what could be the reason?

aldeen,
 i just tried under v12 and this only works on pins 11 & 12 pwm.

fred

Thank you Fred, so this means that analog pins of P4550 are only two (11 & 12).  I thought that analog pins are A13 through A20 as stated in the Pinguino schematic, but when I referred to the table of pins I realized that A13,A20 pins are analog inputs,  however the mentioned example is dealing with 12 analog outputs as it is actually written for Arduino Mega.
aldeen,
pins 13-20 analog inputs 11,12 analog pwm outputs
fred
Reply
07-02-2017, 12:45 AM,
#5
RE: AnalogWriteMega Example Not Working!
(05-02-2017, 11:32 AM)Aldeen19 Wrote: so this means that analog pins of P4550 are only two (11 & 12).  I thought that analog pins are A13 through A20 as stated in the Pinguino schematic, but when I referred to the table of pins I realized that A13,A20 pins are analog inputs,  however the mentioned example is dealing with 12 analog outputs as it is actually written for Arduino Mega.

The naming of the function "analogwrite()" is a little bit confusing. It doesn't mean, "writing" an analog value (voltage) to the pin of the mcu. It tells the controller to do pulse width modulation (pwm) with an duty cycle of X percent. Here you can find an in depth explanation.


derf158 Wrote:I just tried under v12 and this only works on pins 11 & 12 pwm.

@Fred
Are you sure? Have a look at the pinout. The pins D17 and D18 (pins 16 (RC1) and 17 (RC2) on the chip) of the 18f4550 are marked as pwm pins. But maybe I'm wrong...

Oliver
Reply
07-02-2017, 03:26 AM,
#6
RE: AnalogWriteMega Example Not Working!
(07-02-2017, 12:45 AM)pinguPlus Wrote:
(05-02-2017, 11:32 AM)Aldeen19 Wrote: so this means that analog pins of P4550 are only two (11 & 12).  I thought that analog pins are A13 through A20 as stated in the Pinguino schematic, but when I referred to the table of pins I realized that A13,A20 pins are analog inputs,  however the mentioned example is dealing with 12 analog outputs as it is actually written for Arduino Mega.

The naming of the function "analogwrite()" is a little bit confusing. It doesn't mean, "writing" an analog value (voltage) to the pin of the mcu. It tells the controller to do pulse width modulation (pwm) with an duty cycle of X percent. Here you can find an in depth explanation.


derf158 Wrote:I just tried under v12 and this only works on pins 11 & 12 pwm.

@Fred
Are you sure? Have a look at the pinout. The pins D17 and D18 (pins 16 (RC1) and 17 (RC2) on the chip) of the 18f4550 are marked as pwm pins. But maybe I'm wrong...

Oliver
@Oliver
http://wiki.pinguino.cc/index.php/PIC18F4550_Pinguino you had the pin out for the 45k50 this link is for the 4550 which use e11 & 12 as pwm.

fred
Reply
07-02-2017, 03:26 PM,
#7
RE: AnalogWriteMega Example Not Working!
Hello,

(07-02-2017, 03:26 AM)derf158 Wrote: http://wiki.pinguino.cc/index.php/PIC18F4550_Pinguino you had the pin out for the 45k50 this link is for the 4550 which use e11 & 12 as pwm.

ah, yes, you're right. I wasn't aware of the differences of these two chips.
If found a side by side comparison of 4550 and 45k50 on the microchip website.

The 45k50 has just 1 Enhanced Capture Compare PWM Module (with 4 channels), 1 DAC and 25 analog input channels, the 4550 has 1 (normal) CCP and 1 ECCP, no DAC and 12 ADC channels.

Strange. The PWM pins are located at the same position of the chip (RC1 and RC2, pin 16 and 17), but the pinguino names differ (D11, D12).

Oliver
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)