Hello everyone. I have an evaluation kit EKK-LM3S9B96. I try to write simply program, just turn on led. I think i do it good and i don't know where i do mistake.
#include <LM3Sxxxx.H> int main() { GPIODirModeSet(GPIO_PORTD_BASE,GPIO_PIN_7,GPIO_DIR_MODE_OUT); GPIOPinWrite(GPIO_PORTD_BASE,GPIO_PIN_7,0xff); }
I set pin 7 as out and next put there 1. I would be greatfull for some help.
Hi. I read about GPIO settings.
SysCtlClockSet(SYSCTL_SYSDIV_2,SYSCTL_USE_OSC,SYSCTL_XTAL_16MHZ); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE,GPIO_PIN_3); GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_3,0xff);
I think that the section responsible for set GPIO is correct. I just enable peripheral PORTA, set PIN3 as output and write 1. I think the problem is with SysCtlClockSet. I tried several options with this funkcion and possible set clock wrong. Can anyone explain on example what write to SysCtlClockSet if i wanted to get 6MHz when the external oscillator is 16MHz.
Note that this has nothing to do with Keil - you would be better to ask on the TI Stellaris forum.
e2e.ti.com/.../default.aspx
If you do cross-post, be sure to provide links between the threads.
But, again, have you tried the examples that TI provide?
They provide a "Blinky" example that does exactly what you're trying to do...
Not familiar with the processor, but you've missed one thing that sure won't help:
#include <LM3Sxxxx.H> int main() { GPIODirModeSet(GPIO_PORTD_BASE,GPIO_PIN_7,GPIO_DIR_MODE_OUT); GPIOPinWrite(GPIO_PORTD_BASE,GPIO_PIN_7,0xff); for (;;) // <<< Make sure you don't fall off the end of 'main' ; }
I didn't write this but i have the code in while(1) loop so program is running all time. Sorry.
Andrew i saw the Blinky example earlier but it doesn't help me. That example is on another uC and have other APIs functions. I try TI Stellaris forum :)
There is a 'Blinky' example for every Stellaris Evaluation Kit (EK), and the DK-LM3S9B96 - so that covers every Stellaris family!
You didn't - did you?
e2e.ti.com/.../458010.aspx
Yes is me. Forgot paste link there. Once again. I really have EKK not DK Evaluation Kit. I have header LM3Sxxxx.H. There is hw_gpio.h and gpio.h documents. They have some APIs that i use in program. But Blinky use functions that aren't declared in my header. Therefore i don't understand when You write that Blinky is for every Evaluation Kit. What i should do? Many thanks for help.