10130 - How to Start

2011.06.30

KickStart

It would be nice if it is really ‘kick and start’. You should read IAR’s user guides. But if you are lazy, try follow this simplified guide.

            Create a suitable folder on the hard disk. E.g. T0325F
            Launch the IAR Embedded Workbench.
You may want to move it to the desktop.
            Project | Create New Project | C | T0325P      (Click and type.)
            Make | T0325WS                     (Search and Click on the small icon for ‘Make’.)      
            Project | Options… | General Options | Device | STM8S105C6
                                            | Debugger | Driver | ST-LINK | OK
            Edit  main.c  as follows:

//  main12  On-board LED  ON

#include <iostm8s105c6.h>

int main( void ){

  PD_ODR = 0x00 ;   // D0  On-board LED  (0)ON
  PD_DDR = 0x01 ;   // Output
  PD_CR1 = 0x01 ;   // Push Pull
  PD_CR2 = 0x00 ;   // Slow

  return 0;
}

      Make                                       (Click on the icon.)     (Correct any C errors.)
            Connect the kit to the computer and wait till the ‘removable disk’ is ready.
            Download and Debug            (This looks like a green flag.)
            Wait for the debugging icons to appear
            Go                                           (The LED on the kit should turn ON.)
            Stop Debugging
           
            To end the session:
                        Close the ‘removable disk’
Safety Remove the drive
Disconnect the kit
If you re-connect the kit, the program will run immediately and turn on the LED.

Change  PD_ODR = 0x00 ;  to  PD_ODR = 0x01 ;    and the comment…
Repeat the Make / Download / Go / Stop Debugging procedure
                                                (The LED on the kit should turn Off.)
Close the application.

To re-launch the project, go to the folder and click on T0325WS.
.