Erstes Programm STM8s105

Gast #3364724
Lesenswert?

Hallo ich hab mich an diese Anleitung gehalten
http://www.mikrocontroller.net/articles/STM8S-Discovery
aber, wenn ich den Programm Code bei mir einfüge bekomme ich drei 
Errors.
1
#include "stm8s.h"                                         // (1)
2
 
3
main()                                                     // (2)
4
{
5
  GPIO_DeInit(GPIOD);                                      // (3)
6
  GPIO_Init(GPIOD, GPIO_PIN_0,GPIO_MODE_OUT_PP_LOW_SLOW);  // (4)
7
 
8
  while (1)                                                // (5)
9
  {
10
    u16 i;                                                 // (6)
11
 
12
    for(i = 0; i < 60000; i++)                             // (7)
13
    {
14
      nop();                                               // (8)
15
    }
16
 
17
    GPIO_WriteReverse(GPIOD, GPIO_PIN_0);                  // (9)
18
  }                                                        // (10)
19
}
1
Compiling main.c...
2
cxstm8 -istm8s_lib\inc +debug -pxp -no -l +mods0 -pp -i"C:\Program Files\COSMIC\CXSTM8_32K\Hstm8"  -clDebug\ -coDebug\ main.c 
3
#error cpstm8 stm8s_lib\inc\stm8s_gpio.h:62(0) missing enumeration member
4
main.c:
5
 The command: "cxstm8 -istm8s_lib\inc +debug -pxp -no -l +mods0 -pp
6
   -i"C:\Program Files\COSMIC\CXSTM8_32K\Hstm8"  -clDebug\ -coDebug\
7
   main.c " has failed, the returned value is: 1
8
exit code=1.
9

10
main.o - 3 error(s), 0 warning(s)
#3368581
Lesenswert?

poste mal von deinem File "stm8s_gpio.h"
die Zeilen 45 bis 65


das müsste so aussehen :
1
typedef enum
2
{
3
  GPIO_MODE_IN_FL_NO_IT      = (u8)0b00000000,  /*!< Input floating, no external interrupt */
4
  GPIO_MODE_IN_PU_NO_IT      = (u8)0b01000000,  /*!< Input pull-up, no external interrupt */
5
  GPIO_MODE_IN_FL_IT         = (u8)0b00100000,  /*!< Input floating, external interrupt */
6
  GPIO_MODE_IN_PU_IT         = (u8)0b01100000,  /*!< Input pull-up, external interrupt */
7
  GPIO_MODE_OUT_OD_LOW_FAST  = (u8)0b10100000,  /*!< Output open-drain, low level, 10MHz */
8
  GPIO_MODE_OUT_PP_LOW_FAST  = (u8)0b11100000,  /*!< Output push-pull, low level, 10MHz */
9
  GPIO_MODE_OUT_OD_LOW_SLOW  = (u8)0b10000000,  /*!< Output open-drain, low level, 2MHz */
10
  GPIO_MODE_OUT_PP_LOW_SLOW  = (u8)0b11000000,  /*!< Output push-pull, low level, 2MHz */
11
  GPIO_MODE_OUT_OD_HIZ_FAST  = (u8)0b10110000,  /*!< Output open-drain, high-impedance level,10MHz */
12
  GPIO_MODE_OUT_PP_HIGH_FAST = (u8)0b11110000,  /*!< Output push-pull, high level, 10MHz */
13
  GPIO_MODE_OUT_OD_HIZ_SLOW  = (u8)0b10010000,  /*!< Output open-drain, high-impedance level, 2MHz */
14
  GPIO_MODE_OUT_PP_HIGH_SLOW = (u8)0b11010000   /*!< Output push-pull, high level, 2MHz */
15
}GPIO_Mode_TypeDef;

vermutlich hat das File einen Fehler in der letzten ENUM Anweisung
(wahrscheinlich ein Komma zuviel eingetragen)
1
typedef enum
2
{
3
  GPIO_MODE_IN_FL_NO_IT      = (u8)0b00000000,  /*!< Input floating, no external interrupt */
4
  GPIO_MODE_IN_PU_NO_IT      = (u8)0b01000000,  /*!< Input pull-up, no external interrupt */
5
  GPIO_MODE_IN_FL_IT         = (u8)0b00100000,  /*!< Input floating, external interrupt */
6
  GPIO_MODE_IN_PU_IT         = (u8)0b01100000,  /*!< Input pull-up, external interrupt */
7
  GPIO_MODE_OUT_OD_LOW_FAST  = (u8)0b10100000,  /*!< Output open-drain, low level, 10MHz */
8
  GPIO_MODE_OUT_PP_LOW_FAST  = (u8)0b11100000,  /*!< Output push-pull, low level, 10MHz */
9
  GPIO_MODE_OUT_OD_LOW_SLOW  = (u8)0b10000000,  /*!< Output open-drain, low level, 2MHz */
10
  GPIO_MODE_OUT_PP_LOW_SLOW  = (u8)0b11000000,  /*!< Output push-pull, low level, 2MHz */
11
  GPIO_MODE_OUT_OD_HIZ_FAST  = (u8)0b10110000,  /*!< Output open-drain, high-impedance level,10MHz */
12
  GPIO_MODE_OUT_PP_HIGH_FAST = (u8)0b11110000,  /*!< Output push-pull, high level, 10MHz */
13
  GPIO_MODE_OUT_OD_HIZ_SLOW  = (u8)0b10010000,  /*!< Output open-drain, high-impedance level, 2MHz */
14
  GPIO_MODE_OUT_PP_HIGH_SLOW = (u8)0b11010000,   // hier ist ein Komma zuviel
15
}GPIO_Mode_TypeDef;
16

17
Gruss Uwe

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren