I have used both. IAR has better editor and world class compiler. Keil is more suited on ARM though, and has a much better debugger, ideal for new starters. Most of the references you will find in the web will be on Keil. IAR on the other hand, has the advantage of all in one. This means that if someday you switch to another MCU, IAR will propably support it. As far as I know Keil supports only 8051 and ARM cores.2-which compiler is better? (IAR or Keil)
1. If you want something cheap, you may want to try Texas Instruments ARM launchpad.
The boards costs about 5 Euros.
hello friends
I want to start ARM with lpc1768 , help me
1-what do you suggest me in order to start learning ARM??
#include "lpc17xx.h"
#include "lpc17xx_gpio.h"
int main(void) {
GPIO_SetDir(0,1<<21,1);
GPIO_SetValue(0,1<<21);
while(1){
}
}
Thanks alexan_eCan you retry with 1UL<<21 instead of 1<<21
LPC_GPIO0->FIODIR = 1UL<<21; // set P0.21 as output
LPC_GPIO0->FIOCLR = 1UL<<21; // set P0.21 to 0
I haven't any problem in the simulationI'm not sure if it's the code or there is something wrong with the project or the way you program the chip.
What if you try
Code:LPC_GPIO0->FIODIR = 1UL<<21; // set P0.21 as output LPC_GPIO0->FIOCLR = 1UL<<21; // set P0.21 to 0
#include "lpc17xx.h"
#include "lpc17xx_gpio.h"
int main(void)
{
FIO_SetDir(0,0x0000000f,1);
FIO_SetValue(0,0x0000000f);
}
#include "lpc17xx.h"
#include "lpc17xx_gpio.h"
int main(void) {
GPIO_SetDir(0,1<<21,1);
GPIO_SetValue(0,1<<21);
while(1){
}
}
I know 1<<21 is different with 0x0000000f ,that was just an example1<<21 equals 0x00200000 but now you have used 0x0000000f , these two are not the same.
I also suggest you use 1UL<<x , UL means unsigned long because if you don't it may not work correctly due to truncation
by the following program it worked rightActually you have used different functions too, FIO_SetDir and FIO_SetValue instead of GPIO_SetDir and GPIO_SetValue .
You should check the library code to see the difference.
#include "lpc17xx.h"
#include "lpc17xx_gpio.h"
int main(void)
{
GPIO_SetDir(0,0x0000000f,1);
GPIO_SetValue(0,0x0000000f);
while(1)
{
}
}
"lpc17xx_gpio.h" is in the lpc17xx.cmsis.driver.library/DriversWhere did you find the "lpc17xx_gpio.h" header, I can't find it in the code bundle.
.
#include"lpc17xx.h"
#include "lpc17xx_gpio.h"
#include "lpc17xx_libcfg.h"
volatile unsigned long SysTickCnt;
void SysTick_Handler (void);
void Delay (unsigned long tick);
void SysTick_Handler (void) {
SysTickCnt++;
}
void Delay (unsigned long tick) {
unsigned long systickcnt;
systickcnt = SysTickCnt;
while ((SysTickCnt - systickcnt) < tick);
}
int main(void){
GPIO_SetDir(1, 0x10000000, 1); /* LED on P1.0 defined as Output */
SysTick_Config(SystemCoreClock/1000 - 1); /* Generate interrupt each 1 ms */
while(1){
GPIO_SetValue(1,0x10000000); /* LED on P1.0 on */
Delay(300);
GPIO_ClearValue(1, 0x10000000); /* LED on P1.0 off */
Delay(300);
}
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?