----- Original Message ----- From: "MCH" To: "Microcontroller discussion list - Public." Sent: Thursday, February 04, 2010 7:00 PM Subject: [PIC] PWM ASM code > Maybe I'm getting too specific here. Let's make the net larger. > > Does anyone have an example of "working" ASM code that will configure > and output PWM signals? > > All I can find on the net is BASIC or C language. > > I found one great tutorial site that says it has a section on PWM, but > "PWM" is not mentioned once in their tutorial. :-\ > > I also tried looking for app notes on the Microchip website. So, if > anyone knows of a URL for that, it would greatly help as well. > > Again, just looking for a 'how to' with code examples of ASM code for > the PWM output. It doesn't matter what is being controlled with the > output. > > I'm using an 18F4520, but any ASM code would be appreciated, as I'm sure > I could translate it. > > Thanks, > Joe M. > -- " I also tried looking for app notes on the Microchip website. So, if anyone knows of a URL for that, it would greatly help as well." http://www.microchip.com Go to the search box in the upper right of the page and type the letters PWM and press Enter. It is about that easy! Sure, you'll have to do a little reading, but just on the first page I saw three application notes on PWM. Others have already suggested your device datasheet. Great resource. You can also try the microcip forum (access from home page). Look for PWM in the list of subjects under the headings, then click on it. Lots and lots of posts, some with everything you want to copy. If all you want is simple PWM: Set pin HI Wait a little bit A Set pin LO Wait a little bit B Repeat Set the "little bit" A and B to the values you want for whatever PWM signal you are trying to achieve. I don't really know what your goals are. If you just want to play with PWM and if you really can translate any asm code to the 18F asm code, you should be able to write this simple asm program to achieve that. Later, you can learn to use the built-in capabilities of your chip to generate PWM more elegantly (and without tying up the chip for one function). Have fun. Richard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist