Jump to content


  • Content Count

  • Joined

  • Last visited

  1. Thank you Torouva, Great suggestion. I already did as you said and now everything looks fine.
  2. Hello dellwoodbu, Thank you. I tested a global variable and it works.
  3. Hello Everyone, I have a very annoying issue that it seems i am not able to solve. Following the timer example from boards directory from stellarisware, I can't figure it out how to send variables to intrerupt functions handlers like the void Timer0IntHandler(void). Using a static variable inside void main() solves nothing; The thing is that these handlers are used as non called functions, meaning that when the intrerupt occurs they will do their job. In my case I need to pass a variable to them, a variable that in the end will set up a MCU's pin. Thank you in advance for the answer and example. Costin
  4. Hello Bluehash, Thank you for te hint. i admit that I am a litle bit lost in TI's documentation. Maybe a litle more organized would have been better. I will have a look on your recommendation.
  5. Hello everyone, I'm trying to create a new very simple protocol for communicating with other controllers. For this i will use the SN65HVD3082 which is a RS485 transceiver. My protocol will start with a preamble mainly a 101 and after will transmit the necessary data (I will post all updates as i make progress on this). I have real issues though because I really don't understand the API timer functions. Here are my unknowns: a) how do i use TimerIntEnable prototype: void TimerIntEnable(unsigned long ulBase,unsigned long ulIntFlags) I can see in the SW-UG-9453.pdf document that ulIntFlags accepts some defines. in my clear case, i want to catch the time a pin stays on logic 1. How do i do this? After an intrerut is caught, I want to have an intrerupt handler, in this case the best choice being the TimerIntRegister function that has this prototype: void TimerIntRegister(unsigned long ulBase,unsigned long ulTimer,void (*pfnHandler)(void)) suposing my function that handles the intrrupt is void intrruptHandler() can anyone please share an example of how the TimerIntRegister should be written? Thank you Regards, Costin SW-DRL-UG-9453.pdf
  6. Hello bluehash, I did all necessary includes. For convenience I even got all necessary .c and .h files under deriverlib directory taht is used in all labs sessions in the workshop. Costin
  7. cosscat

    Polling a switch

    Dear pradeepa_kck, You are right. It is not doing debouncing. The same issue related to debouncing you have is valid for me also. Costin
  8. cosscat

    Polling a switch

    Hello Friend, Try out this code. It will clarify a lot your questions: #include "inc/hw_gpio.h" #include "inc/hw_memmap.h" #include "inc/hw_sysctl.h" #include "inc/hw_types.h" #include "driverlib/gpio.h" #include "driverlib/sysctl.h" #define LED_RED GPIO_PIN_1 #define LED_BLUE GPIO_PIN_2 #define LED_GREEN GPIO_PIN_3 #define BUTTON_1 GPIO_PIN_0 #define BUTTON_2 GPIO_PIN_4 void main(void) { int light; // configure system clock to run at 50 MHz // use external crystal (16 MHz) and PLL SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ| SYSCTL_OSC_MAIN); // Enable PORT F GPIO SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); // Unlock PF0 so we can change it to a GPIO input // Once we have enabled (unlocked) the commit register then re-lock it // to prevent further changes. PF0 is muxed with NMI thus a special case. HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY_DD; HWREG(GPIO_PORTF_BASE + GPIO_O_CR) |= 0x01; HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = 0; // set LED pins as outputs GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN); // SEE COMMENTS IN THE POST // set user switches as inputs GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, BUTTON_1|BUTTON_2); // turn weak pull-ups on GPIOPadConfigSet(GPIO_PORTF_BASE, BUTTON_1|BUTTON_2, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); // loop forever for (; { light = 0; if(!GPIOPinRead(GPIO_PORTF_BASE, BUTTON_1)) light |= LED_RED; if(!GPIOPinRead(GPIO_PORTF_BASE, BUTTON_2)) light |= LED_BLUE; GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN, light); SysCtlDelay(500000); } } It is derived from a post found on the internet and also a search in buttons.h and buttons.c under StellarisWare directory . Costin,
  9. By the way, I bought a bunch of them, even asked my uninterested friends to help me when they were cheap 4.99 Costin
  10. Hello Everyone, I got really obfuscated and pissed off in terms of this board (St launchpad LM4f). If I can't start two LEDs using button poll how can i get to harder projects? I spent hours trying to figure it out. I don't find it easy at all. My code is like this (trying to expand Lab2): #include "inc/hw_types.h" #include "inc/hw_memmap.h" #include "driverlib/sysctl.h" #include "driverlib/gpio.h" #include "driverlib/buttons.h" int main(void) { int LED = 2; SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); ButtonsInit(); while(1) { // Turn on the LED GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, LED); // Delay for a bit SysCtlDelay(2000000); // Cycle through Red, Green and Blue LEDs if (LED == 8) {LED = 2;} else {LED = LED*2;} } } I moved the buttons.h and buttons.c from drivers to driverlib for convenience of include file paths. But no matter what I do i get this? Description Resource Path Location Type unresolved symbol ButtonsInit, first referenced in ./main.obj lab2 C/C++ Problem Don't consider the code's functionality.This is just to test if it recognizes ButtonsPoll function or not. After hours of intensive tests, got back to litle baby steps. Maybe a TI engineer will enlighten me? I really don't get it. What else does it need??? Thank you, Costin
  • Create New...