Ignore:
Timestamp:
Nov 25, 1999, 2:56:34 PM (26 years ago)
Author:
ansari
Message:

archediab 28 vol

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Poubelle/archediab.old/archediab.sources/c/telecommande.c

    r645 r649  
    55#include "acqui.h"
    66#include "tm.h"
     7#include "simulmission.h"
     8#include "controle.h"
    79
    810
     
    135137{
    136138unsigned char mot_tc[10];
    137 mot_tc[0]       =       tc_reduite;
    138 mot_tc[1]       =       mot1;
    139 mot_tc[2]       =       mot2;
    140 mot_tc[3]       =       mot3;
    141 emission_telecommande(tc_dir_transputer,mot_tc);
     139        {
     140        mot_tc[0]       =       tc_reduite;
     141        mot_tc[1]       =       mot1;
     142        mot_tc[2]       =       mot2;
     143        mot_tc[3]       =       mot3;
     144        emission_telecommande(tc_dir_transputer,mot_tc);
     145        }
    142146}
    143147
     
    148152int j;
    149153
     154if(!acquisition_avec_telecommande)  return;
     155
     156
    150157//*****************************************************************************************
    151158//                                                                                      ***
     
    157164
    158165#define  delai(xx)      {long uu;for(uu=0;uu<(10000L*(long)xx);uu++){};}
    159 #define  tc_char(x)     {delai(20);if(tt->PCI_actif==1) ecrit_carte((x)&0xff);} 
     166#define  tc_char(x)     {delai(40);if(acquisition_PCI) ecrit_carte((x)&0xff);} 
    160167#define  tc_int(x)      {tc_char(x);tc_char(x>>8);tc_char(x>>16);tc_char(x>>24);}
    161168//printf("telecommande: ");
     
    200207                        if( ((mot[0]&0xff)!=tc_reduite) && gg->flag_tc_reduite)
    201208                                {
    202                                 printf("attention: une telecommande normale !!\n\n");
     209                                printf("attention: une telecommande normale non envoyée !!\n\n");
    203210                                son(130);
    204211                                select(printf_ref);
     212                                break;
    205213                                }
    206214//                      pour test en mode simulation sans le retour des blocks reglage du transputer
    207                         if(tt->PCI_actif==2)    relit_telecommandes_reduites(tc);
    208                         else    {
     215                        if(tt->PCI_actif==2)   
     216                                {
     217                                relit_telecommandes_reduites(tc);
     218                                break;
     219                                }
     220                    else if(tt->PCI_actif==3)
     221                        {
     222                        simul_telecommandes_reduites(tc);
     223                        }
     224                        else    {char ss[200];
     225                                                static long t;
     226                       
     227#define tcl(iii)        ((long)mot[iii])
     228                       
     229                                        long mothexa[5];        /* les 5 cara hexa envoyée  */
     230                                        /*  on range les bit: bit 1 en poid fort de tout   */
     231                                        mothexa[0]=tcl(1);      /* 4 bit choix de commande   */
     232                                        mothexa[1]=tcl(2)>>2;   /* les 4 bits poid fort du code direction */
     233                                        mothexa[2]=((tcl(2)<<2)&0xc)  + ((tcl(3)>>6)&0x3);
     234                                        mothexa[3]=(tcl(3)>>2)&0xf; 
     235                                        mothexa[4]=(tcl(3)&0x3) + 0x0C;
     236                                        printf("commande 18bit:   %d %d %d -> %lx%lx%lx%lx%lx ",tcl(1),tcl(2),tcl(3)
     237                                                ,mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4]);
     238                                        ecritD(fenetre_controle,con_subscan,"tc: %x %x %x %x %x ",mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4]);
     239
     240                                tc_char(0x11);  //  synchro
     241                                tc_int(debut_telecommande);
     242                                for(j=0;j<4;j++)        tc_char(mot[j]);
     243                                tc_char(0x00);          //  synchro
     244                                sprintf(ss,"S%X%X%X%X%X07WS%X%X%X%X%X07WS%X%X%X%X%X07W\r\n"
     245                                                ,mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4]
     246                                                ,mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4]
     247                                                ,mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4]);
     248/*                              sprintf(ss,"S%x%x%x%x%x07WS%x%x%x%x%x07WS%x%x%x%x%x07W\r\l"
     249                                                ,mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4]
     250                                                ,mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4]
     251                                                ,mothexa[0],mothexa[1],mothexa[2],mothexa[3],mothexa[4]);*/
     252                                if(ss[7]!='7') erreur("adresse not equal to 7");
     253                                if(ss[16]!='7') erreur("adresse not equal to 7");
     254                                if(ss[25]!='7') erreur("adresse not equal to 7");
     255                                while( (TickCount()>t) et (TickCount()<(t+60*15)) )     // 15sec
     256                                        {
     257                                        static int q;
     258                                        q++;
     259                                        son(130);
     260                                        if(q%10==0) printf("attente pour envoi de telecommande\n");
     261                                        controlemanip(0);
     262                                        }
     263                                son(133);
     264
     265                                printf(" envoi de la telecommande : %s \n",ss);
     266                                ecritRS(0,ss,0);
     267                                t=TickCount();                  //  10 secondes  (tick = 1/60 sec)
     268                                }
     269/*                      else    {
    209270                                tc_char(0x11);  //  synchro
    210271                                tc_int(debut_telecommande);
     
    213274                                tc_char(0x00);tc_char(0x00);    //  synchro
    214275                                }
     276*/
    215277                        break;
    216278
    217279        case    tc_dir_reset_epld       :       //printf("tc_reset_epld:\n");
    218280               
    219 //                      for(j=0;j<14;j++) tc_char(j);
     281                        for(j=0;j<8;j++) tc_char(j);
     282                        tc_char(1);tc_char(1);
     283                        tc_char(0x00);tc_char(0x00);    //  synchro
     284
     285                        break;
     286
     287        case    tc_dir_reset_trp        :       //printf("tc_reset_epld:\n");
     288               
    220289                        for(j=0;j<15;j++) tc_char(j);   // reset epld+transputer
    221290                        tc_char(1);tc_char(1);
     
    233302
    234303//  delai pour separer les télécommandes (archeops, transputer ou non)
    235 if(tt->PCI_actif==1) delai(1000);
     304if(acquisition_PCI) delai(1000);
    236305
    237306#endif          //--------------------------------------------------------------------  ***
Note: See TracChangeset for help on using the changeset viewer.