17
INTRODUCTION As introduction to this report, first let me remind you what the transmission line model is all about. This model will be used to analyze characteristics of different transmission mediums such as the coaxial, p arallel-plate, two-wire transmission lines to mention but a few. The characteristics of the transmission line will then be interpreted and displayed graphically using some sort of a visual display unit such as a computer monitor. That will  be achieved by the use of signals (voltage and current) that will be transported by the  physical transmission line and will pass through various stages until it will be interpreted on the visual display unit. The second topic will then show the block diagram of the whole system, and then an explanation of each block will be discussed in detail. The report will also touch on the  progress I have made as far as the completion of the project is concerned. Pictures of working modules will be presented in the process. Remaining tasks will also be highlighted and when they will be accomplished. 1. BLOCK DIAGRAM AND SYSTEM S CHEMATIC The following diagrams present the systems block and circuit diagrams. Block diagram:

A Transmission Line Model

Embed Size (px)

Citation preview

Page 1: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 1/17

INTRODUCTION

As introduction to this report, first let me remind you what the transmission line model is

all about. This model will be used to analyze characteristics of different transmission

mediums such as the coaxial, parallel-plate, two-wire transmission lines to mention but a

few. The characteristics of the transmission line will then be interpreted and displayed

graphically using some sort of a visual display unit such as a computer monitor. That will

 be achieved by the use of signals (voltage and current) that will be transported by the

 physical transmission line and will pass through various stages until it will be interpreted

on the visual display unit.

The second topic will then show the block diagram of the whole system, and then an

explanation of each block will be discussed in detail. The report will also touch on the

 progress I have made as far as the completion of the project is concerned. Pictures of 

working modules will be presented in the process. Remaining tasks will also be

highlighted and when they will be accomplished.

1. BLOCK DIAGRAM AND SYSTEM SCHEMATIC

The following diagrams present the systems block and circuit diagrams.

Block diagram:

Page 2: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 2/17

Circuit diagram:

The various modules of the block diagram will be discussed in detail in the following

 paragraphs.

1.1 Generator 

Visual

display

unit

RS232

Page 3: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 3/17

This will generate and feed the signal to be transported by the transmission line. That

signal can be voltage or current which can be transmitted at a certain frequency from

the signal generator.

2.2. Transmission line

This is the actual transporter of the generated signal that will, in the end, have its

characteristics interpreted by the visual display unit. Here the type of transmission

line to be used will be specified together with the fundamental characteristics e.g

the characteristic impedance. Since the signal to be transported will be A.C and

since we want to feed it to a microcontroller, we first has to change it to D.C and

then regulate it to acceptable microcontroller levels (between 0V-5V)

2.3 Microcontroller 

The analog signal from the transmission line will then be fed to the microcontroller.

The microcontroller will then use one of its peripherals to convert the analog data to

digital. It will also use another module to serially transmit the converted data to the

visual display unit.

2.4 Max 232 driver chip

Before data can be displayed visually it must first pass through the Max232. This is a

driver chip for the RS232 cable and what it does is it brings the microcontroller 

voltage levels (0V-5V) up to the RS232 levels (usually +/-12V) then it inverts the

signal according to the type of data being sent.

Page 4: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 4/17

2.5. RS232 Cable

This cable acts as an interface between the microcontroller and the visual display unit

or monitor. For proper transmission some parameters such as the baud rate, character 

length, parity bit and stop bit must be set properly. Also the RS232 voltage levels

must be known.

2.6. Visual display unit

This is where the characteristics of the transmission line will be represented

graphically. All the transmission line equations will be interpreted using software like

visual basic which will then plot the values of the parameter being interpreted.

3. PROGRESS

Having obtained enough information with regards to the project, the next step was to

implement all the things I have just explained in the second chapter above.

 

3.1 Signal generation

Page 5: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 5/17

 

The first thing I had to decide was to how I will go about when trying to input my

analog signal to the microcontroller for conversion. The microcontroller accepts

voltage levels from 0V to 5V D.C. So I used a potentiometer to vary the analog input

from the power supply between those acceptable levels. To access the input the

16F877 microcontroller was using pin AN0 (analog input).

But one thing to note is that the potentiometer was only used to observe if we are able

to achieve the analog-to-digital conversion. In the actual operation of the system

instead of using a potentiometer an A.C generator will be used produce the signal to

the transmission line, then that signal will be converted to D.C and upon doing that it

will be regulated to 5V D.C so that it can be within the microcontroller operating

voltages. Then that data will be input to pin AN0 of the microcontroller. Also the

desired transmission frequency will be obtained through the use of an oscillator or a

crystal.

3.2 Analog-to-digital conversion

Since I was now able to feed my analog input using the potentiometer through AN0,

now it was time to convert that data to a digital form. The following code for the

analog-to-digital conversion was written in MPLAB to accomplish the task.

Page 6: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 6/17

CODE 1: A/D conversion

__config _LVP_OFF & _XT_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF & _BODEN_OFF & _DEBUG_OFF

 include "p16f877.inc"

list p=16f877

org 0x005

Start

bsf STATUS,RP0 ;bank 1

bcf STATUS,RP1

movlw B'00000000'

movwf TRISB ;PORTB [pin 0-7] is outputs

clrf ADCON1 ;clear a/d control reg, all inputs a/d

bcf STATUS,RP0 ;bank 0

movlw B'01000001' ;Fosc/8 [pin 7-6], A/D channel is AN0 [pin 5-3], a/d on

movwf ADCON0

Main

bsf ADCON0,GO ;Start A/D conversion

Wait

btfsc ADCON0,GO ;Wait for conversion to complete

goto Wait

movf ADRESH,W ;Write A/D result to PORTB

movwf PORTB ;light up LEDs

return

end

Page 7: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 7/17

What each line of the code does is explained on the far right of the line where

comments are located. The 0V to 5V analog signals will be represented by 0 to 255

digital words and each word is 8-bits long. The code above compiled successfully and

the PIC16F877 was later programmed with success too.

Upon programming, the circuit for testing if the code was functioning fine was wired.

The microcontroller was being clocked by a 4MHz crystal and the filtering capacitors

were 22uF. The input pin was AN0 and the output was taken from PORTB and was

 being observed using LEDs connected between each PORTB pin and ground.

When the potentiometer was varied to produce analog voltages between 0V and 5V,

what was expected was that the LEDs will light up in succession from pin B0 till the

last pin B7. The meaning of LEDs lighting up is that a HI (1) bit is transmitted and if 

it remains unlit a LO (0) is output.

At first this did not work out properly, but having worked on it thoroughly the

expected outcome was obtained. So one can safely say the analog-to-digital

conversion was achieved successfully. The following picture illustrates the results of 

the analog-to-digital converter.

Page 8: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 8/17

Picture1: Digital output word (from LSB =>11100101)

3.3 Reception and transmission of digital data

For reception and transmission of digital data the PIC16F877 uses the USART (Universal

Synchronous Asynchronous Receiver Transmitter) module which is capable of receiving

and sending the available data serially.

Page 9: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 9/17

The following code is that of receiving and transmitting data serially, but the analog-to-

digital conversion code is also included since the USART reception register is supposed

to receive the digital data from PORTB.

CODE 2: Reception and transmission code 

list p=16f877 ; list directive to define processor 

#include "p16f877.inc" ; processor specific variable definitions

 __CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _XT_OSC& _WRT_ENABLE_OFF & _LVP_OFF & _DEBUG_OFF & _CPD_OFF

;----------------------------------------------------------------------------

; Constants

SPBRG_VAL EQU .25 ; set baud rate 9600 for 4 MHz clock  

;----------------------------------------------------------------------------

; Variables

CBLOCK 0x020

Flags ; byte to store indicator flags

ENDC

;----------------------------------------------------------------------------

; Macros to select the register bank 

; Many bank changes can be optimized when only one STATUS bit changes

Bank0 MACRO ; macro to select data RAM bank 0

bcf STATUS,RP0

bcf STATUS,RP1

ENDM

Bank1 MACRO ;macro to select data RAM bank 1

bsf STATUS,RP0

bcf STATUS,RP1

ENDM

Bank2 MACRO ;macro to select data RAM bank 2

bcf STATUS,RP0

bsf STATUS,RP1

ENDM

Page 10: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 10/17

Bank3 MACRO ;macro to select data RAM bank 3

bsf STATUS,RP0

bsf STATUS,RP1

ENDM

; This code executes when a reset occurs.

ORG 0x0005 ;place code at this address

Reset Code: clrf PCLATH ;select program memory page 0

Start

bsf STATUS,RP0 ;bank 1

bcf STATUS,RP1

movlw B'00000000'

movwf TRISB ;portb [7-0] outputs

clrf ADCON1 ;left justified, all inputs a/d

bcf STATUS,RP0 ;bank 0

movlw B'01000001' ;Fosc/8 [7-6], A/D ch0 [5-3], a/d on [0]

movwf ADCON0

Main

bsf ADCON0,GO ;Start A/D conversion

Wait

btfsc ADCON0,GO ;Wait for conversion to completegoto Wait

movf ADRESH,W ;Write A/D result to PORTB

movwf PORTB ;LEDs

call SetupSerial ;set up serial port and buffers

MainLoop:

movf PORTB,W ;PORTB output to W reg

movwf RCREG ;W contents receiver reg

call TransmitSerial ;if so then go transmit the data

goto Main ;go do main loop again

;----------------------------------------------------------------------------

;Transmit data in RCREG when the transmit register is empty.

TransmitSerial: Bank0 ;select bank 0

btfss PIR1,TXIF ;check if transmitter busy

Page 11: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 11/17

goto $-1 ;wait until transmitter is not busy

movwf TXREG ;and transmit the data, RC6

return

;----------------------------------------------------------------------------

;Set up serial port.

SetupSerial: Bank1 ;select bank 1

movlw 0xc0 ;set tris bits for TX and RX

iorwf TRISC,F

movlw SPBRG_VAL ;set baud rate

movwf SPBRG

movlw 0x24 ;enable transmission and high baud rate

movwf TXSTA

Bank0 ;select bank 0

movlw 0x90 ;enable serial port and reception

movwf RCSTA

clrf Flags ;clear all flags

return

END

After the above code was compiled and programmed into the microcontroller, the

reception of the data by the USART module from PORTB and its transmission from themicrocontroller was tested, it seemed to be working properly. The picture below shows

the output from the PIC’s transmission pin (RC6) and from the multimeter we see that the

voltage is within the TTL voltage levels (0V-5V).

Page 12: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 12/17

Picture2: Output from the transmission pin (RC6) = 2.555V

3.4 Increasing voltage from TTL levels to RS232 levels

 

To increase from the microcontroller’s voltage levels to RS232 cable levels we need to

connect a max232 driver chip. The RS232 levels range between +/- 12V. The max232 is

wired as follows.

 

Page 13: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 13/17

Upon wiring the driver as in above, voltage measurements were taken from pin T2out

and the output depended on the data being transmitted. For words above 128 the voltage

is within the RS232 levels but it is inverted or negative whilst for those below 128 also

the levels are within the acceptable ones but now the voltage is positive. These can beseen from the pictures below.

Page 14: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 14/17

Picture3: RS232 levels when word above 128 is transmitted = -7.516V

Page 15: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 15/17

Picture4: RS232 levels when word below 128 is transmitted = 7.165V

From picture4 above it can be observed from the probe that both the LEDs representing a

LO and a HI levels are both lit. In principle those are expected to flicker to show that LO

and HI signals are transmitted, but because the voltage resolution of the analog signal is

19.6mV the human eye can not see that flickering. Otherwise the 1s and 0s are

transmitted.

Page 16: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 16/17

Again from picture4 it can be seen that even if you measure the voltage at the far end of 

the RS232 cable (DB-9 connector on far right of picture) the voltage is the same as

measuring it from T2out. This means that the signal is transported up until it reaches the

DB-9 connector.

4. TASKS TO BE ACCOMPLISHED

The remaining task now is to implement the transmission line equations on visual basicsoftware so that wave patterns of transmission line parameters can be shown visually using

the same software.

To achieve what I have just mentioned above visual basic will continually check the

available data form the com port and that will be read and stored into some file. From that

file the data will then be interpreted by the transmission line parameter equations.

For example, say I want to draw the pattern of the reflection coefficient; I will sample the

voltage from the com port and store that in some file. We know that

Reflection coefficient = Vmax/Vmin

So from the stored voltage values I will pick the minimum and maximum then with that I

will be able to represent the reflection coefficient visually on a computer monitor.

5. CONCLUSION

One can conclude that most of the work has been done since the signal now has been

transmitted up until the DB-9 connector. The only remaining task is to implement the

Page 17: A Transmission Line Model

8/8/2019 A Transmission Line Model

http://slidepdf.com/reader/full/a-transmission-line-model 17/17

transmitted signal using visual basic so that the parameters are represented in form of wave

 patterns. So I hope that before the last presentations occur that task will have been

accomplished.