Differences

This shows you the differences between two versions of the page.

Link to this comparison view

fr:examples:can:wiper:annex2 [2010/03/03 17:09] – créée sdeniaudfr:examples:can:wiper:annex2 [2020/07/20 12:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Annexe 2 ======
  
 +===== Fichier de définition propre au système CAN_VMD =====
 +
 +
 +<code c>
 +
 +//*****************************************************
 +//  Structures de données pour application  CAN VMD
 +//  Nom de fichier: CAN_VMD.h
 +//*****************************************************
 +
 +#ifndef _VMD_H
 +#define _VMD_H
 +
 +
 +// Format de message 
 +typedef struct {
 +    /* nombre d'octets à envoyer, -1 si c'est une Remote Frame */
 +    int dlc;   
 +    unsigned char id1;  /* 8 bits de poids forts de l'ID. */
 +    unsigned char id2;  /* 3 bits de poids faible de l'ID. */
 +    unsigned char data[8];
 +} Message;
 +
 +
 +//  Pour l'identificateur en mode standard
 +typedef union 
 +{
 +struct 
 + {
 + unsigned short ident:11;
 + unsigned short rtr:1;
 + unsigned short nul:4;
 + } identificateur;
 +struct
 + {
 + unsigned char ident1;
 + unsigned char ident2;
 + } registre;
 +unsigned short valeur;
 +} ident_standard;
 +
 +//  Pour l'identificateur en mode étendu
 +typedef union
 +{
 +struct
 + {
 + unsigned long ident:29;
 + unsigned long rtr:1;
 + unsigned long x:2;
 + } identificateur;
 +struct
 + {
 + unsigned char ident1;
 + unsigned char ident2;
 + unsigned char ident3;
 + unsigned char ident4;
 + } registre;
 +unsigned long valeur;
 +} ident_extend;
 +
 +// Pour registre d'information Trame SJA1000
 +typedef union
 + {
 + struct
 + {
 + unsigned char extend:1;
 + unsigned char rtr:1;
 + unsigned char nul:2;
 + unsigned char dlc:4;
 + } champ;
 + unsigned char registre;
 + } tr_info;
 +
 +// Pour Trame circulant sur réseau CAN
 +typedef struct
 +{
 +tr_info trame_info;
 +union
 + {
 + ident_standard standard;
 + ident_extend   extend;
 + } ident;
 +unsigned char data[8];
 +} Trame;
 +
 +typedef union
 +{
 +struct
 + {
 + unsigned char GP7:1;
 + unsigned char GP6:1;
 + unsigned char GP5:1;
 + unsigned char GP4:1;
 + unsigned char GP3:1;
 + unsigned char GP2:1;
 + unsigned char GP1:1;
 + unsigned char GP0:1;
 + }bit;
 +unsigned char valeur;
 +}Port_8ES;
 +Port_8ES Etat_Commodo_Feux;
 +#define Valeur_Commodo_Feux Etat_Commodo_Feux.valeur
 +#define Cde_Veilleuse Etat_Commodo_Feux.bit.GP0
 +#define Cde_Warning Etat_Commodo_Feux.bit.GP1
 +#define Cde_Phare Etat_Commodo_Feux.bit.GP2
 +#define Cde_Code Etat_Commodo_Feux.bit.GP3
 +#define Cde_Clign_Gauche Etat_Commodo_Feux.bit.GP4
 +#define Cde_Clign_Droit Etat_Commodo_Feux.bit.GP5
 +#define Cde_Stop Etat_Commodo_Feux.bit.GP6
 +#define Cde_Klaxon Etat_Commodo_Feux.bit.GP7
 +
 +// Pour la Commande des feux
 +#define Cde_Nulle 0x00
 +#define Cde_FV_V 0x01 // Feux aVant en Veilleuse
 +#define Cde_FR_V 0x01 // Feux aRrière en Veilleuse
 +#define Cde_FV_C 0x03 // Feux aVant en Code
 +#define Cde_FR_C 0x01 // Feux aRrière en Code
 +#define Cde_FV_P 0x05 // Feux aVant en Phare
 +#define Cde_FR_P 0x01 // Feux aRrière en Phare
 +#define Masque_Clign_AV 0x08 // Pour Clignotant AVant
 +#define Masque_Clign_AR 0x04 // Pour Clignotant ARrière
 +#define Masque_Klaxon 0x08 // Pour Claxon
 +#define Masque_Stop 0x02 // Pour Stop
 +
 +//  Variables pour la commande et le control des feux
 +//----------------------------------------------------
 +//  Pour variables images de la commande effectuée des différents feux
 +union byte_bits Image_FVG,Image_FVD,Image_FRD,Image_FRG;
 +// Pour Feux aVant Gauche
 +#define Valeur_FVG Image_FVG.valeur // Pour un accés port complet
 +#define Veilleuse_FVG Image_FVG.bit.b0 
 +#define Code_FVG Image_FVG.bit.b1
 +#define Phare_FVG Image_FVG.bit.b2
 +#define Clignot_FVG Image_FVG.bit.b3
 +// Pour Feux aVant Droit
 +#define Valeur_FVD Image_FVD.valeur // Pour un accés port complet
 +#define Veilleuse_FVD Image_FVD.bit.b0 
 +#define Code_FVD Image_FVD.bit.b1
 +#define Phare_FVD Image_FVD.bit.b2
 +#define Clignot_FVD Image_FVD.bit.b3
 +// Pour Feux aRrière Droit
 +#define Valeur_FRD Image_FRD.valeur // Pour un accés port complet
 +#define Veilleuse_FRD Image_FRD.bit.b0 
 +#define Stop_FRD Image_FRD.bit.b1
 +#define Clignot_FRD Image_FRD.bit.b2
 +#define Klaxon_FRD Image_FRD.bit.b3
 +// Pour Feux aRrière Gauche
 +#define Valeur_FRG Image_FRG.valeur // Pour un accés port complet
 +#define Veilleuse_FRG Image_FRG.bit.b0 
 +#define Stop_FRG Image_FRG.bit.b1
 +#define Clignot_FRG Image_FRG.bit.b2
 +#define Klaxon_FRG Image_FRG.bit.b3
 +
 +// Pour les variables images des "Status" des sorties de puissance
 +union byte_bits Image_Stat_FVG,Image_Stat_FVD,Image_Stat_FRD,Image_Stat_FRG;
 +// Pour image "Status" Feux aVant Gauche
 +
 +#define Valeur_Status_FVG Image_Stat_FVG.valeur // Pour un accés port complet
 +#define S_Veilleuse_FVG Image_Stat_FVG.bit.b4
 +#define S_Code_FVG Image_Stat_FVG.bit.b5
 +#define S_Phare_FVG Image_Stat_FVG.bit.b6
 +#define S_Clignot_FVG Image_Stat_FVG.bit.b7
 +// Pour image "Status" Feux aVant Droit
 +#define Valeur_Status_FVD Image_Stat_FVD.valeur // Pour un accés port complet
 +#define S_Veilleuse_FVD Image_Stat_FVD.bit.b4
 +#define S_Code_FVD Image_Stat_FVD.bit.b5
 +#define S_Phare_FVD Image_Stat_FVD.bit.b6
 +#define S_Clignot_FVD Image_Stat_FVD.bit.b7
 +// Pour image "Status" Feux aRrière Droit
 +#define Valeur_Status_FRD Image_Stat_FRD.valeur // Pour un accés port complet
 +#define S_Veilleuse_FRD Image_Stat_FRD.bit.b4
 +#define S_Stop_FRD Image_Stat_FRD.bit.b5
 +#define S_Clignot_FRD Image_Stat_FRD.bit.b6
 +#define S_Klaxon_FRD Image_Stat_FRD.bit.b7
 +// Pour image "Status" Feux aRrière Gauche
 +#define Valeur_Status_FRG Image_Stat_FRG.valeur // Pour un accés port complet
 +#define S_Veilleuse_FRG Image_Stat_FRG.bit.b4
 +#define S_Stop_FRG Image_Stat_FRG.bit.b5
 +#define S_Clignot_FRG Image_Stat_FRG.bit.b6
 +#define S_Klaxon_FRG Image_Stat_FRG.bit.b7
 +
 +//  Déclaration des identificateurs, pour les différents modules sur le bus  VMD
 +//--------------------------------------------------------------------------------
 +// Pour Feux aVant Gauche
 +#define Ident_T_IRM_FVG 0x0E041E07 // Feux aVant Gauche en interrogation (Information Request Message)
 +#define Ident_T_IM_FVG 0x0E080000 // Feux aVant Gauche en commande (Input Message)
 +#define Ident_T_AIM_FVG 0x0E200000 // Feux aVant Gauche en Acquittement commande
 +// Pour Feux aVant Droit
 +#define Ident_T_IRM_FVD 0x0E841E07 // Feux aVant Droit en interrogation (Information Request Message)
 +#define Ident_T_IM_FVD 0x0E880000 // Feux aVant Droit en commande (Input Message)
 +#define Ident_T_AIM_FVD 0x0EA00000 // Feux aVant Droit en Acquittement commande
 +// Pour Feux aRierre Gauche
 +#define Ident_T_IRM_FRG 0x0F041E07 // Feux aRrière Gauche en interrogation (Information Request Message)
 +#define Ident_T_IM_FRG 0x0F080000 // Feux aRrière Gauche en commande (Input Message)
 +#define Ident_T_AIM_FRG 0x0F200000 // Feux aRrière Gauche en Acquittement commande
 +// Pour Feux aRierre Droit
 +#define Ident_T_IRM_FRD 0x0F841E07 // Feux aRrière Droit en interrogation (Information Request Message)
 +#define Ident_T_IM_FRD 0x0F880000 // Feux aRrière Droit en commande (Input Message)
 +#define Ident_T_AIM_FRD 0x0FA00000 // Feux aRrière Droit en Acquittement commande
 +// Pour Commodo Feux
 +#define Ident_T_IM_Commodo_Feux 0x05080000 // Commodo feux en commande (Information Message)
 +#define Ident_T_AIM_Commodo_Feux 0x05200000 // Commodo feux : Acquittement suite à une IM
 +#define Ident_T_IRM_Commodo_Feux 0x05041E07 // Commodo feux en interrogation (Information Request Message)
 +// Pour Essuie Glace
 +#define Ident_T_IM_Commodo_EG 0x05880000 // Commodo EG en commande (Information  Message)
 +#define Ident_T_AIM_Commodo_EG 0x05A00000 // Commodo EG en commande (Information  Message)
 +#define Ident_T_IRM1_Commodo_EG 0x05841E07 // Commodo EG en interrogation:  1 octet demandé
 +#define Ident_T_IRM8_Commodo_EG 0x05840000 // Commodo EG en interrogation:  8 octets demandés
 +#define Ident_T_OB_Commodo_EG 0x05900000 // Commodo EG "On Bus" (Par scéduleur)
 +// Pour module Asservissement
 +#define Ident_T_IM_Asservissement 0x00880000 // "Asservissement" en commande (Input Message)
 +#define Ident_T_IRM1_Asservissement 0x00841E07 // "Asservissement" en interrogation: 1 octet en réponse
 +#define Ident_T_IRM8_Asservissement 0x00840000 // "Asservissement" en interrogation: 8 octets en réponse 
 +#define Ident_T_AIM_Asservissement 0x00A00000 // "Asservissement" en Acquittement commande
 +#define Ident_T_OB_Asservissement 0x00900000 // "Asservissement" en On Bus (par scéduleur)
 +
 +// Pour le "Commodo Essuie Glace"
 +Port_8ES Commodo_EG;
 +#define Etat_Commodo_EG Commodo_EG.valeur
 +#define Valeur_Commodo_EG Commodo_EG.valeur
 +#define Cde_EG_Av_Int Commodo_EG.bit.GP0 // Commande Essuie Glace Avant en Intermittant
 +#define Entree1 Commodo_EG.bit.GP1
 +#define Entree2 Commodo_EG.bit.GP2
 +#define Cde_EG_Av_Pos1 Commodo_EG.bit.GP3 // Commande Essuie Glace Avant en Position1
 +#define Cde_EG_Av_Pos2 Commodo_EG.bit.GP4 // Commande Essuie Glace Avant en Position2
 +#define Cde_EG_Ar Commodo_EG.bit.GP5 // Commande Essuie Glace Arrière
 +#define Cde_Lave_Glace_Ar Commodo_EG.bit.GP6
 +#define Cde_Lave_Glace_Av Commodo_EG.bit.GP7
 +
 +#endif
 +
 +
 +</code>
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0