Difference between revisions of "PWM Generator"

From Ethersex_Wiki
Jump to: navigation, search
(Connection)
Line 22: Line 22:
 
== Connection ==
 
== Connection ==
  
Every channels requieres a port.
+
Every channels requieres a port., but since the timers are used the ports are fix defined by the pins of the microcontroller.
  
At the moment none of the standard boards has a pin configuration already implemented. It would not make much sense, because you would have to adapt it anyway.
+
Nevertheless you have to do some pin definition.
 
+
Here the version for the AtMega32:
So here a example you can modify and copy to the configuration of the board used:
 
  
 
  ifdef(`conf_PWM', `dnl
 
  ifdef(`conf_PWM', `dnl
 
  #ifdef CH_A_PWM_GENERAL_SUPPORT
 
  #ifdef CH_A_PWM_GENERAL_SUPPORT
   pin(CHANNEL_A_PWM, PC0, OUTPUT)
+
   pin(CHANNEL_A_PWM, PD5, OUTPUT)
 
  #endif /* CH_A_PWM_GENERAL_SUPPORT */
 
  #endif /* CH_A_PWM_GENERAL_SUPPORT */
 
  #ifdef CH_B_PWM_GENERAL_SUPPORT
 
  #ifdef CH_B_PWM_GENERAL_SUPPORT
   pin(CHANNEL_B_PWM, PC1, OUTPUT)
+
   pin(CHANNEL_B_PWM, PD4, OUTPUT)
 
  #endif /* CH_B_PWM_GENERAL_SUPPORT */
 
  #endif /* CH_B_PWM_GENERAL_SUPPORT */
 
  #ifdef CH_C_PWM_GENERAL_SUPPORT
 
  #ifdef CH_C_PWM_GENERAL_SUPPORT
   pin(CHANNEL_C_PWM, PC2, OUTPUT)
+
   #error 3 Channel pwm unsupported.
 
  #endif /* CH_C_PWM_GENERAL_SUPPORT */
 
  #endif /* CH_C_PWM_GENERAL_SUPPORT */
 
  ')
 
  ')
  
 
You can also use the script add-hardware (in folder scripts) to generate a board-layout for your current configuration. I don't know the current status of the script - so it is possible, that not every features is supported.
 
You can also use the script add-hardware (in folder scripts) to generate a board-layout for your current configuration. I don't know the current status of the script - so it is possible, that not every features is supported.

Revision as of 19:16, 22 May 2012

PWM Generator
Status
Unstable/Broken
menuconfig I/O->PWM Generator
Pinning yes
Ecmd yes
Depends on ECMD
Requires -
Code https://github.com/ethersex/ethersex/tree/master/hardware/pwm

Pulse wide modulator generator with up to 3 channels.

This module uses the avr timers to generate the pwm signals, so for every channel a timer is necessary. It depends on the hardware and other modules, if thre timers are available for the the three channels.

To get background infos you can have a look at this tutorial (in german): [AVR-Tutorial: PWM]


Connection

Every channels requieres a port., but since the timers are used the ports are fix defined by the pins of the microcontroller.

Nevertheless you have to do some pin definition. Here the version for the AtMega32:

ifdef(`conf_PWM', `dnl
#ifdef CH_A_PWM_GENERAL_SUPPORT
 pin(CHANNEL_A_PWM, PD5, OUTPUT)
#endif /* CH_A_PWM_GENERAL_SUPPORT */
#ifdef CH_B_PWM_GENERAL_SUPPORT
 pin(CHANNEL_B_PWM, PD4, OUTPUT)
#endif /* CH_B_PWM_GENERAL_SUPPORT */
#ifdef CH_C_PWM_GENERAL_SUPPORT
  #error 3 Channel pwm unsupported.
#endif /* CH_C_PWM_GENERAL_SUPPORT */
')

You can also use the script add-hardware (in folder scripts) to generate a board-layout for your current configuration. I don't know the current status of the script - so it is possible, that not every features is supported.