This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

FX2 Crash after writing in struct

I use a Cypress Fx2. It's no problem to write a value to dcf.sekunde but if i set dcf.minute to 0 or such a other value, the controller will stops/crash.

I'm not sure if the struct definition is correct or if i must reserver a address block for it. i hope someone can help me.

Thanks

Sorry for my bad English.

FX2_DCF-Clock.h

 typedef xdata struct signal {
unsigned char sekunde;
unsigned char minute;
unsigned char stunde;
unsigned char tag;
unsigned char wochentag;
unsigned char monat;
unsigned char jahr;
unsigned char synkro;
unsigned int  fehler_zaehler;
}tdcf;

extern tdcf dcf;

.

FX2_DCF-Clock.c

 txdata tdcf dcf;
 if(dcf.sekunde>59)
        {
                dcf.synkro=KEINSYNK;
                dcf.sekunde=0;

crash/stop

                dcf.minute=0;
                dcf.stunde=0;
        }

Parents
  • It is quite common with:

    typedef struct tag_1 {
    } tag_2;
    

    tag_1 is the name it has within the "struct" namespace, i.e.:

    struct node {
        struct node* next;
        int value;
    };
    
    struct node *head;  // ok
    node *tail;         // invalid - "struct" keyword needed.
    

    tag_2 is the type-defined name of the struct, i.e. intended for:

    typedef struct {
        unsigned char age;
        char* name;
    } person_t;
    
    person_t charlie;
    person_t benny;
    

Reply
  • It is quite common with:

    typedef struct tag_1 {
    } tag_2;
    

    tag_1 is the name it has within the "struct" namespace, i.e.:

    struct node {
        struct node* next;
        int value;
    };
    
    struct node *head;  // ok
    node *tail;         // invalid - "struct" keyword needed.
    

    tag_2 is the type-defined name of the struct, i.e. intended for:

    typedef struct {
        unsigned char age;
        char* name;
    } person_t;
    
    person_t charlie;
    person_t benny;
    

Children
No data