I had looked up the internal registers and such, but I was unsure of exactly how to code it up. I've had one class with microcontrollers, but the registers were always already set up for us. We just had to use them and assign the correct values to them.
Late last night, after digging around, I found what I was looking for and got something to work. For any other newbies that come across this thread:
I generated a codewarrior project with the initializations that I wanted
I grabbed the functions that related to the peripheral that I actually needed the init for (pwm in my case)
Also check the pin assignment functions (I didn't do this at first, and the pwm was probably functioning, but it was not assigned to a pin!)
If one just copies that into another project, you'll be missing some symbols, running a search in the "include" folder should find them
Copy those into either another header file to include with your project or put the ones you need at the top of your .c file.
I ended up with something like this:
//set up the pwm, enable pwm1
MCF_PWM_PWMPER1 = MCF_PWM_PWMPER_PERIOD(0xf);
MCF_PWM_PWMDTY1 = MCF_PWM_PWMDTY_DUTY(0x4);
MCF_PWM_PWMPOL = MCF_PWM_PWMPOL_PPOL1;
MCF_PWM_PWMCLK = MCF_PWM_PWMCLK_PCLK1;
MCF_PWM_PWMPRCLK = MCF_PWM_PWMPRCLK_PCKA(0x7);
MCF_PWM_PWMCAE = 0;
MCF_PWM_PWMCTL = 0;
MCF_PWM_PWMSCLA = MCF_PWM_PWMSCLA_SCALEA(0x12);
MCF_PWM_PWMSCLB = 0;
MCF_PWM_PWME = MCF_PWM_PWME_PWME1;
MCF_PWM_PWMSDN = 0;
//make sure it is assigned to an output pin!
MCF_GPIO_DDRTA = 0;
MCF_GPIO_PTAPAR = MCF_GPIO_PTAPAR_PTAPAR0(0x3);
**Then later in the code (under an if statement that kept track of the potentiometer AtD conversion)
MCF_PWM_PWMDTY1 = MCF_PWM_PWMDTY_DUTY(0xd);
This sets up PWM1 output on GPT0 (which is measurable on J1 pin 13 on my DEMO board) to output a low duty cycle square wave that changes to a higher duty cycle when the potentiometer is turned past a certain point. (later on in the project, it will be toggled by something else, but this was a good experiment to start with)
I included the mcf5223_pwm.h file and a few lines of the mcf5223_gpio.h file in a header of my own to get everything to compile and function correctly.
Thanks to scifi for the tips!
@scifi: I understand that writing my own register definitions would be a much better solution. If I had ever done that before, I certainly would have. My healthy respect for my own ability to screw it up and the fact that I'm simply not comfortable doing that as a first attempt kept me from doing it myself. Now that I have something working that I can toy with, I will probably do some refactoring and in the future will be able to write the definitions. Also, I do not even know what you mean when you say "toolchain."
thanks again