You are on page 1of 7

In main module, using c code peripheral,USART receive

and global interrupts from registers are enabled. Then LCD


is initialized and strings are displayed on LCD.Then
interrupts for SER_REC,RECR_DLY and RAMP_R are
enabled. Then the ADC module and LCD display modules
are called.

Main Module

In serial receive interrupt module,RECR_DLY or TMR2 is disabled ,then character is received and
stored in temp reg.Character received in Temp reg is shifted and rec_count is incremented and
RECR_DLY is enabled.
In this module, data is received serially.

Serial Recieve

In this module ,Rec_Dly is incremented till it equals to 20.When equals to


20,Rec_count is checked, till equal to 8.When it does, data which was shifted in
serial module is now transferred in byte and char and Rec_count is set to zero.

Receive Delay

In this module value send to adc by potentiometer. By varying the value of variable resistor, fire angle is varied from 0 to 180 degree. Switch is connected,
Switch is used for selection between local control(variable resistor) and computer control.

Analogue reading

In this module, data is displayed on LCD.If switch is pressed, then it


connects to ground and equal to zero and computer control is selected. If
switch is not pressed.it connects to 5V and equal to 1 and local control is
selected.

Display

In this module ramp is generated and pulses are generated. Three square waves one for each phase R,S,T are as input to RB0,RB1,RB2. Initially
RP_Flag=0 and R_PULSE=RP_Flag,it samples previous and next value, if both values are same, counter values increases and ramp is generated when the
input value changes to 1,R_counter=0 and R_PULSE=1 and R_PULSE=RP_Flag ,it samples previous and next value, if both values are same, counter
values increases and ramp is generated.So there are three ramps for each phase R,S,T.
If RP_Flag=1(Positive cycle),R+=1,S-=1,R-=0 and if RP_Flag=0(negative cycle)R+=0,S+=1,R-=1(For reference, consult 3diagram ).

Firing sequence

Firing sequence

You might also like