Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I need ARM C Examples

Status
Not open for further replies.

sarathikannan

Newbie level 2
Joined
Jan 17, 2014
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
14
Good Noon,
I need arm& c coding examples.where i can get it...please give me some links to download it
 

Which ARM MCU you are using
This links is showing STM32F407VG reference of Discovery board which is excellent development board and cheap

https://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF252419

This is example written by me using above development board to blink LED

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "stm32f4xx.h"
//#include "stm32f4xx_gpio.h"
void Delay(__IO uint32_t nCount);
__IO uint32_t i;
__IO uint32_t Del_val = 3000000;
 
 
 
 
int main()
{
RCC->AHB1RSTR |= RCC_AHB1RSTR_GPIODRST; // Reset GPIOD to ensure reset values exist
RCC->AHB1RSTR = 0; // Exit reset state
RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN | RCC_AHB1ENR_GPIOAEN; // Enable GPIOD clock
GPIOD->MODER |= GPIO_MODER_MODER12_0 | GPIO_MODER_MODER13_0 | // Enable output mode for D12-D15
GPIO_MODER_MODER14_0 | GPIO_MODER_MODER15_0;
GPIOD->OSPEEDR |= GPIO_OSPEEDER_OSPEEDR12_1 | GPIO_OSPEEDER_OSPEEDR13_1 |
GPIO_OSPEEDER_OSPEEDR14_1 | GPIO_OSPEEDER_OSPEEDR15_1;
GPIOA->PUPDR |= GPIO_PUPDR_PUPDR0_1; //GPIO_PUPDR_PUPDR0_1 ((uint32_t)0x00000002) = 10: Pull-down
 
 
while(1)
{
if(GPIOA->IDR &= GPIO_IDR_IDR_0 != 0)
{
for(i = 0; i < 3; i++)
{
GPIOD->ODR ^= GPIO_BSRR_BS_15; // GPIOD->BSRRL = GPIO_BSRR_BS_12;
Delay(Del_val);
GPIOD->ODR ^= GPIO_BSRR_BS_14;
Delay(Del_val);
GPIOD->ODR ^= GPIO_BSRR_BS_13;
Delay(Del_val);
GPIOD->ODR ^= GPIO_BSRR_BS_12;
}
}
}
}
 
 
void Delay(__IO uint32_t nCount)
{
while(nCount--)
{
}
}



 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top