
Bernard
-
Content Count
68 -
Joined
-
Last visited
Reputation Activity
-
Bernard got a reaction from nesslersreagent in LM4F120 PWM
Hi,
I have found an excellent tutorial about PWM on Stellarpad that help me to understand .
Here is the Energia version :
/* PWM * TIMER0 B * PF_1 RED_LED */ #include "inc/hw_memmap.h" #include "driverlib/sysctl.h" #include "driverlib/gpio.h" #include "driverlib/timer.h" unsigned long ulPeriod, dutyCycle; void setup() { ulPeriod = 2000; dutyCycle = 500; // PF_1 on T0CCP1 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinConfigure(GPIO_PF1_T0CCP1); GPIOPinTypeTimer(GPIO_PORTF_BASE, GPIO_PIN_1); // Timer configuration SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); TimerConfigure(TIMER0_BASE,TIMER_CFG_SPLIT_PAIR|TIMER_CFG_B_PWM); TimerLoadSet(TIMER0_BASE, TIMER_B, ulPeriod -1); TimerMatchSet(TIMER0_BASE, TIMER_B, dutyCycle); TimerEnable(TIMER0_BASE, TIMER_; } void loop() { TimerMatchSet(TIMER0_BASE, TIMER_B, dutyCycle++); if(dutyCycle >= ulPeriod - 1) dutyCycle = 0; delay(1); } // End of .ino file I wanted to share .. it could be usefull for beginers like me.
Salutations
Bernard
-
Bernard got a reaction from energia in LM4F120 PWM
Hi,
I have found an excellent tutorial about PWM on Stellarpad that help me to understand .
Here is the Energia version :
/* PWM * TIMER0 B * PF_1 RED_LED */ #include "inc/hw_memmap.h" #include "driverlib/sysctl.h" #include "driverlib/gpio.h" #include "driverlib/timer.h" unsigned long ulPeriod, dutyCycle; void setup() { ulPeriod = 2000; dutyCycle = 500; // PF_1 on T0CCP1 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinConfigure(GPIO_PF1_T0CCP1); GPIOPinTypeTimer(GPIO_PORTF_BASE, GPIO_PIN_1); // Timer configuration SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); TimerConfigure(TIMER0_BASE,TIMER_CFG_SPLIT_PAIR|TIMER_CFG_B_PWM); TimerLoadSet(TIMER0_BASE, TIMER_B, ulPeriod -1); TimerMatchSet(TIMER0_BASE, TIMER_B, dutyCycle); TimerEnable(TIMER0_BASE, TIMER_; } void loop() { TimerMatchSet(TIMER0_BASE, TIMER_B, dutyCycle++); if(dutyCycle >= ulPeriod - 1) dutyCycle = 0; delay(1); } // End of .ino file I wanted to share .. it could be usefull for beginers like me.
Salutations
Bernard
-
Bernard got a reaction from bluehash in LM4F120 PWM
Hi,
I have found an excellent tutorial about PWM on Stellarpad that help me to understand .
Here is the Energia version :
/* PWM * TIMER0 B * PF_1 RED_LED */ #include "inc/hw_memmap.h" #include "driverlib/sysctl.h" #include "driverlib/gpio.h" #include "driverlib/timer.h" unsigned long ulPeriod, dutyCycle; void setup() { ulPeriod = 2000; dutyCycle = 500; // PF_1 on T0CCP1 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinConfigure(GPIO_PF1_T0CCP1); GPIOPinTypeTimer(GPIO_PORTF_BASE, GPIO_PIN_1); // Timer configuration SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); TimerConfigure(TIMER0_BASE,TIMER_CFG_SPLIT_PAIR|TIMER_CFG_B_PWM); TimerLoadSet(TIMER0_BASE, TIMER_B, ulPeriod -1); TimerMatchSet(TIMER0_BASE, TIMER_B, dutyCycle); TimerEnable(TIMER0_BASE, TIMER_; } void loop() { TimerMatchSet(TIMER0_BASE, TIMER_B, dutyCycle++); if(dutyCycle >= ulPeriod - 1) dutyCycle = 0; delay(1); } // End of .ino file I wanted to share .. it could be usefull for beginers like me.
Salutations
Bernard
-
Bernard got a reaction from bluehash in Sample UDEV file for Stellaris Launchpad
Hi Shaun,
Nice to read you have it working.
May be adding your username to the dialout group could help ... unless you already did that.
I have ported TI internal temperature sensor example to Energia and posted it on Energia forum ... it works .. nothing spectacular but I am learning and trying to understand step by step.
Happy coding
Cheers
Bernard
-
Bernard got a reaction from bluehash in Sample UDEV file for Stellaris Launchpad
Hi,
I am on Unbuntu 10.04.
I created a file in directory : etc/udev/rules.d named : 61-stellapad.rules (Ty Rick)
and pasted :
SUBSYSTEM=="usb",ATTRS{idVendor}=="1cbe",ATTRS{idP roduct}=="00fd",MODE="0666"
save and unplug .. replug Stellaris board.
Hope this can help you
Salutations
Bernard
-
Bernard got a reaction from sirri in Reading LM4F120 internal temp sensor
Hello,
Here is a ino file that allow to display temperature from LM4F120 internal sensor.
It is based on example from TI workbook , ported a la mode Energia.
Nothing spectacular. I am slowly learning ARM and I wanted to share.
/* Read internal temperature sensor of LM4F120 Stellaris Launchpad Example from TI LM4F120 workbook A la mode Energia */ #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/debug.h" #include "driverlib/sysctl.h" #include "driverlib/adc.h" #include "Energia.h" unsigned long ulADC0Value[4]; volatile unsigned long ulTempAvg; volatile unsigned long ulTempValueC; volatile unsigned long ulTempValueF; void setup() { Serial.begin(9600); SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); SysCtlADCSpeedSet(SYSCTL_ADCSPEED_125KSPS); // 250 ADCSequenceDisable(ADC0_BASE, 1); ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0); ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 3, ADC_CTL_TS | ADC_CTL_IE | ADC_CTL_END); ADCSequenceEnable(ADC0_BASE, 1); } void loop() { ADCIntClear(ADC0_BASE, 1); ADCProcessorTrigger(ADC0_BASE, 1); while(!ADCIntStatus(ADC0_BASE, 1, false)) { } ADCSequenceDataGet(ADC0_BASE, 1, ulADC0Value); ulTempAvg = (ulADC0Value[0] + ulADC0Value[1] + ulADC0Value[2] + ulADC0Value[3] + 2)/4; ulTempValueC = (1475 - ((2475 * ulTempAvg)) / 4096)/10; ulTempValueF = ((ulTempValueC * 9) + 160) / 5; Serial.println(ulTempValueC); delay(300); } Salutations.
Bernard
-
Bernard got a reaction from Xtagon in Reading LM4F120 internal temp sensor
Hello,
Here is a ino file that allow to display temperature from LM4F120 internal sensor.
It is based on example from TI workbook , ported a la mode Energia.
Nothing spectacular. I am slowly learning ARM and I wanted to share.
/* Read internal temperature sensor of LM4F120 Stellaris Launchpad Example from TI LM4F120 workbook A la mode Energia */ #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/debug.h" #include "driverlib/sysctl.h" #include "driverlib/adc.h" #include "Energia.h" unsigned long ulADC0Value[4]; volatile unsigned long ulTempAvg; volatile unsigned long ulTempValueC; volatile unsigned long ulTempValueF; void setup() { Serial.begin(9600); SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); SysCtlADCSpeedSet(SYSCTL_ADCSPEED_125KSPS); // 250 ADCSequenceDisable(ADC0_BASE, 1); ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0); ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 3, ADC_CTL_TS | ADC_CTL_IE | ADC_CTL_END); ADCSequenceEnable(ADC0_BASE, 1); } void loop() { ADCIntClear(ADC0_BASE, 1); ADCProcessorTrigger(ADC0_BASE, 1); while(!ADCIntStatus(ADC0_BASE, 1, false)) { } ADCSequenceDataGet(ADC0_BASE, 1, ulADC0Value); ulTempAvg = (ulADC0Value[0] + ulADC0Value[1] + ulADC0Value[2] + ulADC0Value[3] + 2)/4; ulTempValueC = (1475 - ((2475 * ulTempAvg)) / 4096)/10; ulTempValueF = ((ulTempValueC * 9) + 160) / 5; Serial.println(ulTempValueC); delay(300); } Salutations.
Bernard
-
Bernard got a reaction from xv4y in Reading LM4F120 internal temp sensor
Hello,
Here is a ino file that allow to display temperature from LM4F120 internal sensor.
It is based on example from TI workbook , ported a la mode Energia.
Nothing spectacular. I am slowly learning ARM and I wanted to share.
/* Read internal temperature sensor of LM4F120 Stellaris Launchpad Example from TI LM4F120 workbook A la mode Energia */ #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/debug.h" #include "driverlib/sysctl.h" #include "driverlib/adc.h" #include "Energia.h" unsigned long ulADC0Value[4]; volatile unsigned long ulTempAvg; volatile unsigned long ulTempValueC; volatile unsigned long ulTempValueF; void setup() { Serial.begin(9600); SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); SysCtlADCSpeedSet(SYSCTL_ADCSPEED_125KSPS); // 250 ADCSequenceDisable(ADC0_BASE, 1); ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0); ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 3, ADC_CTL_TS | ADC_CTL_IE | ADC_CTL_END); ADCSequenceEnable(ADC0_BASE, 1); } void loop() { ADCIntClear(ADC0_BASE, 1); ADCProcessorTrigger(ADC0_BASE, 1); while(!ADCIntStatus(ADC0_BASE, 1, false)) { } ADCSequenceDataGet(ADC0_BASE, 1, ulADC0Value); ulTempAvg = (ulADC0Value[0] + ulADC0Value[1] + ulADC0Value[2] + ulADC0Value[3] + 2)/4; ulTempValueC = (1475 - ((2475 * ulTempAvg)) / 4096)/10; ulTempValueF = ((ulTempValueC * 9) + 160) / 5; Serial.println(ulTempValueC); delay(300); } Salutations.
Bernard
-
Bernard got a reaction from energia in Reading LM4F120 internal temp sensor
Hello,
Here is a ino file that allow to display temperature from LM4F120 internal sensor.
It is based on example from TI workbook , ported a la mode Energia.
Nothing spectacular. I am slowly learning ARM and I wanted to share.
/* Read internal temperature sensor of LM4F120 Stellaris Launchpad Example from TI LM4F120 workbook A la mode Energia */ #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/debug.h" #include "driverlib/sysctl.h" #include "driverlib/adc.h" #include "Energia.h" unsigned long ulADC0Value[4]; volatile unsigned long ulTempAvg; volatile unsigned long ulTempValueC; volatile unsigned long ulTempValueF; void setup() { Serial.begin(9600); SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); SysCtlADCSpeedSet(SYSCTL_ADCSPEED_125KSPS); // 250 ADCSequenceDisable(ADC0_BASE, 1); ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0); ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 3, ADC_CTL_TS | ADC_CTL_IE | ADC_CTL_END); ADCSequenceEnable(ADC0_BASE, 1); } void loop() { ADCIntClear(ADC0_BASE, 1); ADCProcessorTrigger(ADC0_BASE, 1); while(!ADCIntStatus(ADC0_BASE, 1, false)) { } ADCSequenceDataGet(ADC0_BASE, 1, ulADC0Value); ulTempAvg = (ulADC0Value[0] + ulADC0Value[1] + ulADC0Value[2] + ulADC0Value[3] + 2)/4; ulTempValueC = (1475 - ((2475 * ulTempAvg)) / 4096)/10; ulTempValueF = ((ulTempValueC * 9) + 160) / 5; Serial.println(ulTempValueC); delay(300); } Salutations.
Bernard
-
Bernard got a reaction from Rickta59 in Reading LM4F120 internal temp sensor
Hello,
Here is a ino file that allow to display temperature from LM4F120 internal sensor.
It is based on example from TI workbook , ported a la mode Energia.
Nothing spectacular. I am slowly learning ARM and I wanted to share.
/* Read internal temperature sensor of LM4F120 Stellaris Launchpad Example from TI LM4F120 workbook A la mode Energia */ #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/debug.h" #include "driverlib/sysctl.h" #include "driverlib/adc.h" #include "Energia.h" unsigned long ulADC0Value[4]; volatile unsigned long ulTempAvg; volatile unsigned long ulTempValueC; volatile unsigned long ulTempValueF; void setup() { Serial.begin(9600); SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); SysCtlADCSpeedSet(SYSCTL_ADCSPEED_125KSPS); // 250 ADCSequenceDisable(ADC0_BASE, 1); ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0); ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_TS); ADCSequenceStepConfigure(ADC0_BASE, 1, 3, ADC_CTL_TS | ADC_CTL_IE | ADC_CTL_END); ADCSequenceEnable(ADC0_BASE, 1); } void loop() { ADCIntClear(ADC0_BASE, 1); ADCProcessorTrigger(ADC0_BASE, 1); while(!ADCIntStatus(ADC0_BASE, 1, false)) { } ADCSequenceDataGet(ADC0_BASE, 1, ulADC0Value); ulTempAvg = (ulADC0Value[0] + ulADC0Value[1] + ulADC0Value[2] + ulADC0Value[3] + 2)/4; ulTempValueC = (1475 - ((2475 * ulTempAvg)) / 4096)/10; ulTempValueF = ((ulTempValueC * 9) + 160) / 5; Serial.println(ulTempValueC); delay(300); } Salutations.
Bernard