IAR EW- No Samples?

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I have IAR Embedded Workbench, and I doen't know how to start.
I can make a new Project, add some C- Files and compile the project, but how can I:

1) Use the ADC (in different Modes)
2) Use the Timers to generate a PWM Signal
3)...

Are there no sample Programs? 1700$ and no examples? Is there a Website where I can find some examples or does anone have some code fragments for me?

Thanks for any answer,
Wolf

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First off welcome to the world of 'give me your money' IAR.

If you visit the Atmel site and have a look at the app notes you will find several have software examples in C for the IAR compiler. But before you set out using the ADC or the PWM features read the data sheets on the device you are using and get to understand the device.

The IAR 'lack of examples' is excused on the basis they are producing a 'C' compiler not a how to programing guide.

But when you hit on a feature in the IAR that you do not understand don't hold your breath while waiting for help!

If you require help on a specific AVR problem then you will get help on this site but when it is a general how do I use the ADC then your first call should be the app notes and data sheets, then some experimentation.

MIke

Keep it simple it will not bite as hard

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello, thanks for your answer.
My Problem is not to understanding the AVR devices, I used them in so much projects that I can't count them :-)

My Problems are IAR- specific, like: If I would use an ADC, what ist the exact IAR EW statement for use the ADC Interrupt? witch #pragma I have to use? Codevision uses "interrupt" statements, Imagecraft the "pragma's" and GCC the "Signal" term, all describet in examples, no problem. So how can I know, what I have to use in IAR C, without examples?

And not only for ADC, how about Timers, Comperators etc...

Thanks,
Wolf

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Perhaps you should ask IAR these questions. After all, they are the ones that received your license fee. :)

Lee [not an IAR user]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is a compiler users manual in the (you'd never guess) \doc directory. The file is called cavr.pdf

Igor [IAR user because somebody else picked up the bill :-]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The interrupt names are actual given in the header file for the device you are using
As an example here is the listing from the 128 header file
/* NB! vectors are specified as byte addresses */

#define RESET_vect (0x00)
#define INT0_vect (0x04)
#define INT1_vect (0x08)
#define INT2_vect (0x0C)
#define INT3_vect (0x10)
#define INT4_vect (0x14)
#define INT5_vect (0x18)
#define INT6_vect (0x1C)
#define INT7_vect (0x20)
#define TIMER2_COMP_vect (0x24)
#define TIMER2_OVF_vect (0x28)
#define TIMER1_CAPT_vect (0x2C)
#define TIMER1_COMPA_vect (0x30)
#define TIMER1_COMPB_vect (0x34)
#define TIMER1_OVF_vect (0x38)
#define TIMER0_COMP_vect (0x3C)
#define TIMER0_OVF_vect (0x40)
#define SPI_STC_vect (0x44)
#define USART0_RXC_vect (0x48)
#define USART0_UDRE_vect (0x4C)
#define USART0_TXC_vect (0x50)
#define ADC_vect (0x54)
#define EE_RDY_vect (0x58)
#define ANA_COMP_vect (0x5C)
#define TIMER1_COMPC_vect (0x60)
#define TIMER3_CAPT_vect (0x64)
#define TIMER3_COMPA_vect (0x68)
#define TIMER3_COMPB_vect (0x6C)
#define TIMER3_COMPC_vect (0x70)
#define TIMER3_OVF_vect (0x74)
#define USART1_RXC_vect (0x78)
#define USART1_UDRE_vect (0x7C)
#define USART1_TXC_vect (0x80)
#define TWI_vect (0x84)
#define SPM_RDY_vect (0x88)

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If I understand correctly, the problem is how to define interrupt handlers:

If you are using EWA90 (1.x):

interrupt [USART_RXC_vect] void USART_RX_interrupt(void)
{
blabla();
}

If you are using EWAVR (2.x):

#pragma vector=_RXC_vect
__interrupt void USART_RXC_interrupt(void){
blabla();
}

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

$1700 for IAR is a bargain! I called up IAR in the UK for a price and they wanted £1600 (approx $2730!).
Richard.

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

IAR is a bit expensive, but it is nevertheless a good compiler.
I've used it for ARM7tdmi.
Also, the JTAG debugger (at least the ARM one) is quite useful.

[sometimes a IAR ARM7 user]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And when you can shoehorn your code into a smaller flash version because the optimisation is so good, you have just saved yourself a pile of money.

Igor

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If desperate for space save even more money use asm.

Mike

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sutton: At the cost of longer development time, harder debuging, and harder for other ppl to upgrade the code in the future.

The cost of a IAR license is much lower than all the extra manhours to write and debug the whole thing using asm.