PROFIBUS over 802.11b

by

 

03 Nov 2003 (Updated )

Polling based PROFIBUS MAC layer over a 802.11 PHY.

wPROFIBUS_Device_Init.m
%*********************************************************************
% Description:      Main initialization code
%********************************************************************
disp(['Initialize: ', gcb])

%Set global variables
 % PHY specific stuff
    % fixed values
    Samples_per_chips               = 8;
    Spreading_rate                  = 11;
    Chip_rate                       = 11e6;
    SYNC_size_long                  = 128;
    SYNC_size_short                 = 56;
    SFD_size                        = 16;
    SFD                             = de2bi(hex2dec('F3A0'), SFD_size, 'left-msb');
	SIGNAL_size                     = 8;
	SERVICE_size                    = 8;
	LENGTH_size                     = 16;
	CRC_size_PHY                    = 16;
    CRC_polynom_PHY                 = [16 12 5 0];
    CRC_init_vector_PHY             = [1 0 0 0 0 1 0 0 1 1 0 0 1 1 1 1];
    Scrambler_polynom               = [0 -4 -7];
    Scrambler_init_vector_short     = [0 0 1 1 0 1 1];
    Scrambler_init_vector_long      = [1 1 0 1 1 0 0];
    Barker_sequenz                  = [1 -1 1 1 -1 1 1 1 -1 -1 -1]';
    %load cck_codes;                % needed for HR receiver
   
    switch Datarate_menu
        case 1
            Datarate    = 10;
        case 2
            Datarate    = 20;
        case 3
            Datarate    = 55;
        case 4
            Datarate    = 110;
    end        
    
    Preamble    = Preamble_menu - 1; % 0 if Long, 1 if Short
    if ((Preamble==1) & (Datarate==10))
        errordlg('Short Preamble cannot be used with 1Mbps rate');
    end
    
    Modulation  = Modulation_menu - 1; % 0 if CCK, 1 if PBCC
    
 % RF specific stuff
    TX_powerlevel_vector_dB = 10*log10(TX_powerlevel_vector/1000);
    Level_RSSI = 0:1:100;
    Level_dBm  = -99:1:1;  
    
    
 % MAC specific stuff
    SD_size             = 8;
    SD1_value           = [0 0 0 1 0 0 0 0]; % h10 no data
    SD2_value           = [0 1 1 0 1 0 0 0]; % h68 with variable data (max 246 octets)
    SD3_value           = [1 0 1 0 0 0 1 0]; % hA2 with fixed data (8 octets)
    SD4_value           = [1 1 0 1 1 1 0 0]; % hDC poll
    SD5_value           = [1 1 1 0 0 1 0 1]; % hE5 ack
    DA_size             = 8;
    SA_size             = 8;
    FC_size             = 8;
    k_size              = 8;
    FCS_size            = 8;
    ED_size             = 8;
    ED_value            = [0 0 0 1 0 1 1 0];
    
    
 disp(['Done Initialize: ', gcb])
    


    
    
    
    
    
    
    
    

Contact us