Close



Results 1 to 10 of 83

Threaded View

  1. #10
    Staff Engineer printbus's Avatar
    Join Date
    May 2014
    Location
    Highlands Ranch, Colorado USA
    Posts
    1,437
    Add printbus on Thingiverse
    What's needed here is someone already familiar with temperature control options in Marlin. For all I know, PWM control on the heater output is a simple configuration file change.

    The ATMEGA2560 processor provides a number of hardware PWM channels, but each is associated with a particular processor pin. For purposes of flexibility regardless of underlying hardware, the Arduino libraries also support software-based PWM. Software PWM can be used with any pin. Software-based PWMs will typically run slower than possible in hardware, along with some cost in software overhead. Slower doesn't mean they'd be unacceptably slow. Assuming the 7 Hz rate is correct, a 7 Hz PWM frequency is still far faster than the bang-bang control loop.

    More info on the hardware-based PWM: RAMPS D8, D9, and D10 are all connected to ATMEGA2560 pins that can be, at least theoretically, configured as hardware PWM outputs. When configured for hardware PWM, RAMPS D8 for the default heat bed connection is derived from ATMEGA2560 timer/counter 4, as can be the D6 servo output. Separate output compare registers for D6 (register OC4A) and D8 (register OC4C) are provided to allow the on/off ratio for D6 and D8 to be managed independently. With both derived from the same timer/counter, both D6 and D8 would have the same pulse train frequency. The other output compare register on timer/counter 4, OC4B, is associated with an ATMEGA2560 pin that is not passed to RAMPS.

    How much Marlin and the underlying Arduino libraries can already leverage the hardware-based PWM would be where someone with existing knowledge would help. I know more about the AVR processors themselves than I do about Marlin and Arduino.

    Understanding the internal workings of the hardware timers isn't trivial. The ATMEL datasheets are light on top-level info on how to make them work. I typically look into Arduino sketches or C-code examples on avrfreaks when I need to do something new with them.
    Last edited by printbus; 08-28-2015 at 02:02 PM. Reason: corrected OC4C label on D8

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •