train lab manual
TRANSCRIPT
-
8/10/2019 train lab manual
1/24
MODEL TRAIN INTERFACE BOARD(Model No : VIPAC / VLIM - 04)
Application Manual
Version 1.0
Technical Clarification /Suggestion : /
Technical Support Division,Vi Microsystems Pvt. Ltd.,Plot No :75,Electronics Estate,Perungudi,Chennai - 600 096,INDIA.Ph: 91- 44-2496 1842, 91-44-2496 1852Mail : [email protected],Web : www.vimicrosystems.com
-
8/10/2019 train lab manual
2/24
PREFACE
The VIPAC-10 Application Manual". Manual provides you with all the basic details of theModel Train Interface Board functional theory specifications, schematics and functions of Optoisolated I/O and D/A converter.
Chapter - 01 This chapter gives the introduction of this interface board.
Chapter - 02 This chapter gives details of Theory of operation and working principle of Optoisolated I/O interface.
Chapter - 03 This chapter gives details of Theory of operation and working principle of D/A
converter.
Chapter - 04 This chapter gives the sample programs of this interface card.
Suggestions are welcome for further improvement on this manual.
Write to:
The Customer-Support Division,Vi Microsystems Pvt. Ltd.,Plot No.75, Electronics Estate,Perungudi, Chennai - 600 096.Phone:2496 3142, 4204 8142
-
8/10/2019 train lab manual
3/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 1 ]
CHAPTER - 1
ABOUT VIPAC/VLIM-04INTRODUCTION
The VIPAC/VLIM-04 you have just acquired is certainly a powerful product of great value andhence has to be protected in a proper manner. Here are a few guidelines as to how you should usethe interface card. At any situation, please follow these guidelines and try to make maximum useof this interface card to enhance your knowledge in the filed of microcontrollers.
This manual briefs the hardware specifications available on VIPAC/VLIM-04. The availableconnectors, sensors, ICs function are all specified clearly. Further detailed explanation regardingany unit can be had from the respective chapters allotted to them.
HARDWARE SPECIFICATION
Bus Configuration
VPIC-Bus - The VPIC bus has been connected in mother boards processor port linesare terminated at this bus connector. These port lines are control thevariable device in the VIPAC/VLIM-04 interface board.
VLIM-Bus - The VLIM bus has been connected in mother boards 8255 ICs port lines
are terminated at this bus connector.
(Or)
The VPIC header lines are convert the VLIM header through theVIPAC/VLIM/VVSI-01 interface card.
PCA9551D-LED Driver
The PCA9551 LED Blinker blinks LEDs in I2C-bus and SMBus applications where it isnecessary to limit bus traffic or free up the I2C Masters timer. The uniqueness of this device isthe internal oscillator with two programmable blink rates. To blink LEDs using normal I/OExpanders like the PCF8574 or PCA9554, the bus master must send repeated commands to turnthe LED on and off. This greatly increases the amount of traffic on the I2C-bus and uses up oneof the masters timers.
-
8/10/2019 train lab manual
4/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 2 ]
The PCA9551 LED Blinker instead requires only the initial set up command to program BLINK RATE 1 and BLINK RATE 2 (i.e., the frequency and duty cycle) for each individual output.From then on, only one command from the bus master is required to turn each individual open
drain output ON, OFF, or to cycle at BLINK RATE 1 or BLINK RATE 2. Maximum output sink current is 25 mA per bit and 100 mA per package.
The PCA9551D ICs output are connected to the LEDs for train movement.
BUFFER:
The 74LS244 buffer IC is used for get the input from the sensor(L14G3) and the tiny switches(SW1 & SW2).
LATCH:
The 74LS273 latch IC is used for output the data to traffic signals leds and the level crossingLEDs..
SENSOR:
The L14G3 type sensors are used in the VIPAC/VLIM-04 interface board. The sensors outputsare connected to the buffer.
TINNY SWITCH:
There are two tinny switches are used in VIPAC/VLIM-04 interface board. The SW1 is used for ON/OFF the train movement control. The SW2 is used for direction Control (Forward or Reversedirection).
-
8/10/2019 train lab manual
5/24
-
8/10/2019 train lab manual
6/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 4 ]
26-Pin FRC Header:
In this VIPAC/VLIM-04 interface card we can used the VLIM-Bus connector. In this header we
can get the 8255 port lines or get the processor port lines through the VIPAC/VLIM/VVSI-01.
I 2C based LED Driver:
The PCA9551D I2C based LED Driver is used in the VIPAC/VLIM-04 interface card.
FEATURES of PCA9551D:
8 LED drivers (on, off, flashing at a programmable rate) 2 selectable, fully programmable blink rates (frequency and duty cycle) between 0.148
Hz and 38 Hz (6.74 and 0.026 seconds) Input/outputs not used as LED drivers can be used as regular GPIOs Internal oscillator requires no external components I2C-bus interface logic compatible with SMBus Internal power-on reset Noise filter on SCL/SDA inputs Active-LOW reset input 8 open drain outputs directly drive LEDs to 25 mA Edge rate control on outputs No glitch on power-up Supports hot insertion Low stand-by current Operating power supply voltage range of 2.3 V to 5.5 V 0 to 400 kHz clock frequency
VCC
RD0RD1RD2RD3RD4RD5RD6RD7
RE0RB4RB1RC3RC4
RE1RE2
P1VLIM-BUS
1 142 153 164 175 186 197 208 219 2210 2311 2412 2513 26
-
8/10/2019 train lab manual
7/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 5 ]
IC Diagram
PCA9551D
-
8/10/2019 train lab manual
8/24
-
8/10/2019 train lab manual
9/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 7 ]
REGISTER DESCRIPTON:
LS0 LED03 SELECTOR
LS1 LED47 SELECTOR
The LSx LED select registers determine the source of the LED data.
00 = Output is set LOW (LED on)01 = Output is set Hi-Z (LED off default)10 = Output blinks at PWM0 rate11 = Output blinks at PWM1 rate
-
8/10/2019 train lab manual
10/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 8 ]
Buffer:
The buffer is a logic circuit which amplifies the current or power. It has a one input line and one
output line. The logic level of the output is the same as that of the input; logic 1 input provideslogic 1 output( the opposite of an inverter). The buffer is used primarily to increase the drivingcapability of a logic circuit. It is known as a driver.
In our VIPAC/VLIM-04 interface card we can used the 74LS244 buffer. The buffer input dataget from the sensors and the switches.
Latch:
A latch is used commonly to interface output devices. When the MPU sends an output, data areavailable on the data bus for only a few microseconds, and therefore, a latch is used to hold datafor display.
In our VIPAC/VLIM-04 interface card we can used the 74LS273 latch. These latch is used datato hold data for led display.
VCC
RD0
RD1RD2RD3RD4RD5RD6
S5S6
S2
S1
S3S4
RB4
RD7S7S8
U1274LS244
24
68
11131517
119
1816
14129753
2010
1A1
1A21A31A42A12A22A32A4
1G2G
1Y1
1Y21Y31Y42Y12Y22Y32Y4
VCCGND DC12
0.1MFD
-
8/10/2019 train lab manual
11/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 9 ]
Sensor:
In our VIPAC/VLIM-04 interface card we can used the L14G3 sensor. The sensor out normallyin high voltage, when the active the sensor output goes to low. The sensor output lines areterminated into the buffer.
VCC
VCC
L11L12
L10L9
RD3RD2RD1
RD4
RD0
RE2
RD5RD6RD7
RST-
L13L14L15L16
R116
1K
DC100.1MFD
U10
74LS273
3
478
13141718
111
2
56912151619
2010
D1D2D3D4D5D6D7D8
CLKCLR
Q1Q2Q3Q4Q5Q6Q7Q8
VCCGND
VCC
S1
R1091K
S1
L14G2
R99
33K
-
8/10/2019 train lab manual
12/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 10 ]
Tinny Switch:
There are two tinny switches are used in our VIPAC/VLIM-04 interface card. The sw1 & sw2
is put the high volt in the down position. It also put the low volt in the up position. The tinnyswitches output lines are also terminated into the buffer.
VCCS7
SW1
INP3
123
R105
1K
-
8/10/2019 train lab manual
13/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 11 ]
CHAPTER - 3
SAMPLE PROGRAM
INTRODUCTION
In this chapter give the sample program to run the VIPAC/VLIM-04 interface card using theUniversal Embedded Trainer.
Program-1
To run the Model Train Interface Card using the Universal Embedded Trainer with PIC16F877.
AIM:
To run the train when the sw1 is on the up position. And then the sw2 is on the up position thetrain is move on the forward direction else the train is moved on the reverse direction. The trainis stop the station1 and station2 with control the sensors and the traffic signals leds.
Program:
#include #use delay(clock=20000000)
#use rs232(baud=19200, xmit=PIN_C6, rcv=PIN_C7)#use I2C(MASTER,sda=PIN_C4,scl=PIN_C3)
unsigned char data,a,b,c;unsigned char ls0[]={0x55,0x54,0x50,0x40,0x00,0x00,0x01,0x05,0x15,0x55};//led0-led3 selector for forward direction.unsigned char ls1[]={0x55,0x15,0x05,0x01,0x00,0x00,0x40,0x50,0x54,0x55};//led0-led3 selector for reverse direction.
/* 0x55 - for glow the led0 to led3.0x54 - for glow the led1 to led3.0x50 - for glow the led2 to led3.0x40 - for glow the led3 to led3.0x00 - for do not glow the led0 to led3.*/
//unsigned char ls1[]={0x00,0x01,0x05,0x15,0x55}; //led4-led7 selector./*
0x00 - for do not glow the led4 to led7.0x01 - for glow the led4 to led4.0x05 - for glow the led4 to led5.
-
8/10/2019 train lab manual
14/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 12 ]
0x15 - for glow the led4 to led6.0x55 - for glow the led4 to led7.
*/
unsigned char sel[]={0x0c0,0x0c2,0xc4,0xc6,0xc8,0xca,0xcc,0xce,0x0c0};unsigned char sel1[]={0x0ce,0xcc,0xca,0xc8,0xc6,0xc4,0xc2,0x0c0,0xce};
//unsigned char sig[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};/*
THESE LINES ARE CONNECTED TO U9.PULSE PIN IS "RE1".0x01 - green for reverse rotaion station1.(L1)0x02 - yellow for reverse rotaion station1.(L2)0x04 - red for reverse rotaion station1.(L3)0x08 - green for forward rotaion station1.(L4)0x10 - yellow for forward rotaion station1.(L5)0x20 - red for forward rotaion station1.(L6)0x40 - green for reverse rotaion station2.(L7)0x80 - yellow for reverse rotaion station2.(L8)
THESE LINES ARE CONNECTED TO U10.PULSE PIN IS "RE2".0x01 - red for reverse rotaion in station2.(L9)0x02 - green for forward rotaion in station2.(L10)
0x04 - yellow for forward rotaion in station2.(L11)0x08 - red for forward rotaion in station2.(L12)*/
unsigned char i,i1,j,k=0x15,senout,senout1,senout2,senout3;
void crossingon();void crossingoff();void init();
void initbuf();void sensor();void sensor1();void station1forward();void station2forward();void station1reverse();void station2reverse();void sw();void sw1();void reverse();
void forward();
-
8/10/2019 train lab manual
15/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 13 ]
void main(){
init();
initbuf();while(1){
start1:for(j=0x00;j
-
8/10/2019 train lab manual
16/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 14 ]
sw(); //read the data from the buffer.if((b != 0x0)||(c == 0x80)) //check for sw1 & sw2 is high.
goto start;
sensor();senout++;if(senout < 0x05)
delay_ms(200);else if(senout == 0x05) //check the station1.{
delay_ms(0x2000); //wait some delay in station1.
initbuf();
output_d(0x10); //glow the yellow led for station1 in forward.output_low(PIN_E1);output_high(PIN_E1);
delay_ms(1000);
initbuf();
output_d(0x08); //glow the green led for station1 in forward.output_low(PIN_E1);
output_high(PIN_E1);delay_ms(100);}
if((senout > 0x05) && (senout
-
8/10/2019 train lab manual
17/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 15 ]
delay_ms(100);}
if((senout1 > 0x05) && (senout1
-
8/10/2019 train lab manual
18/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 16 ]
{output_d(0x0); //not glow the station1 signal.output_low(PIN_E1);
output_high(PIN_E1);crossingon();}
b = a; b = b & 0x08;if(b != 0x08) //sensor4 is set to low(enable) for open the level crossing.
crossingoff();
b = a; b = b & 0x10;if(b != 0x10) //sensor5 is set to low(enable).
station2forward();}
void crossingon(){
output_d(0xF0);output_low(PIN_E2);output_high(PIN_E2);
output_d(0xFF);output_low(PIN_B1);output_high(PIN_B1);
}
void crossingoff(){
output_d(0x00);output_low(PIN_E2);output_high(PIN_E2);
output_d(0x00);output_low(PIN_B1);output_high(PIN_B1);
}void station1forward(){
initbuf();output_d(0x20); //glow the red led for station1 in forward.output_low(PIN_E1);
output_high(PIN_E1);
-
8/10/2019 train lab manual
19/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 17 ]
delay_ms(100); //decrement the speed for stop the train in station1.
output_low(PIN_B4);
a=input_d(); //get the data from the buffer.output_high(PIN_B4);
b=a; b= b & 0x01;if(b == 0x01) //sensor1 is set to high(disable).
senout=0x01;}
void station2forward(){
initbuf();output_d(0x08); //glow the red led for statio2 in forward.output_low(PIN_E2);output_high(PIN_E2);
delay_ms(100); //decrement the speed for stop the train in station1.
output_low(PIN_B4);a=input_d(); //get the data from the buffer.output_high(PIN_B4);
b = a; b = b & 0x10;if(b == 0x10) //sensor1 is set to high(disable).
senout1=0x01;}
void sw(){
output_low(PIN_B4);a=input_d(); //get the data from the buffer.output_high(PIN_B4);
b=a; b= b & 0x40; //check for switch1.
c=a;c= c & 0x80; //check for switch2.
if((b == 0x0) &&(c == 0x80))reverse();
}
-
8/10/2019 train lab manual
20/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 18 ]
void reverse(){
init();
initbuf();while(1){
start3:for(j=0x00;j
-
8/10/2019 train lab manual
21/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 19 ]
i1++;}
sw1(); //read the data from the buffer.if((b != 0x0) || (c != 0x80)) //check for sw1 & sw2 is high.goto start4;
sensor1();
senout2++;if(senout2 < 0x05)
delay_ms(200);else if(senout2 == 0x05) //check the station2 in reverse dircetion.{
delay_ms(0x2000); //wait some delay in station2 in reverse dirction.
initbuf();
output_d(0x80); //glow the yellow led for station2 in reverse.output_low(PIN_E1);output_high(PIN_E1);
delay_ms(1000);
initbuf();
output_d(0x40); //glow the green led for station2 in reverse.output_low(PIN_E1);output_high(PIN_E1);delay_ms(100);
}
if((senout2 > 0x05) && (senout2
-
8/10/2019 train lab manual
22/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 20 ]
output_d(0x02); //glow the yellow led for station1 in reverse.output_low(PIN_E1);output_high(PIN_E1);
delay_ms(1000);
initbuf();
output_d(0x01); //glow the green led for station1 in reverse.output_low(PIN_E1);output_high(PIN_E1);
delay_ms(100);}
if((senout3 > 0x05) && (senout3
-
8/10/2019 train lab manual
23/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 21 ]
b = a; b = b & 0x08;if(b != 0x08) //sensor4 is set to low(enable) for open the level crossing.
crossingon();
b = a; b = b & 0x02;if(b != 0x02) //sensor2 is set to low(enable).
station1reverse();}
void station1reverse(){
initbuf();output_d(0x04); //glow the red led for station1 in forward.output_low(PIN_E1);output_high(PIN_E1);delay_ms(100); //decrement the speed for stop the train in station1.output_low(PIN_B4);a=input_d(); //get the data from the buffer.output_high(PIN_B4);
b=a; b= b & 0x02;
if(b == 0x02) //sensor1 is set to high(disable).senout3=0x01;}void station2reverse(){
initbuf();output_d(0x01); //glow the red led for statio2 in forward.output_low(PIN_E2);output_high(PIN_E2);delay_ms(100); //decrement the speed for stop the train in station1.output_low(PIN_B4);a=input_d(); //get the data from the buffer.output_high(PIN_B4);
b = a; b = b & 0x20;if(b == 0x20) //sensor1 is set to high(disable).
senout2=0x01;}
void sw1()
{
-
8/10/2019 train lab manual
24/24
MODEL TRAIN INTERFACE BOARD VIPAC/VLIM-04
Vi Microsystems Pvt. Ltd. [ 22 ]
output_low(PIN_B4);a=input_d(); //get the data from the buffer.output_high(PIN_B4);
b=a; b= b & 0x40; //check for switch1.
c=a;c= c & 0x80; //check for switch2.
}
void initbuf(){
output_d(0x00); //not glow the all led.output_low(PIN_E1);output_high(PIN_E1);
output_d(0x00); //not glow the all led.output_low(PIN_E2);output_high(PIN_E2);
output_d(0x00); //not glow the all led.output_low(PIN_B1);output_high(PIN_B1);
}