The ALS-EMB-EVAL-03 evaluation board is a comprehensive aid to understand the capabilities of an advanced micro controller like 8051 compatible Atmel 89C51ED2. Features of ATMEL AT89C51ED2 On-chip 64KB flash program / data memory. On-chip 1792 bytes Expanded RAM (xram). On-chip 2048 bytes EEROM. On.chip 16-bit Programmable Counter Array. Operation at frequency 11.0592MHz.
The ALS-EMB-EVAL-03 evaluation board is a comprehensive aid to understand the capabilities of an advanced micro controller like 8051 compatible Atmel 89C51ED2. Features of ATMEL AT89C51ED2 On-chip 64KB flash program / data memory. On-chip 1792 bytes Expanded RAM (xram). On-chip 2048 bytes EEROM. On.chip 16-bit Programmable Counter Array. Operation at frequency 11.0592MHz.
Direitos autorais:
Attribution Non-Commercial (BY-NC)
Formatos disponíveis
Baixe no formato PDF, TXT ou leia online no Scribd
The ALS-EMB-EVAL-03 evaluation board is a comprehensive aid to understand the capabilities of an advanced micro controller like 8051 compatible Atmel 89C51ED2. Features of ATMEL AT89C51ED2 On-chip 64KB flash program / data memory. On-chip 1792 bytes Expanded RAM (xram). On-chip 2048 bytes EEROM. On.chip 16-bit Programmable Counter Array. Operation at frequency 11.0592MHz.
Direitos autorais:
Attribution Non-Commercial (BY-NC)
Formatos disponíveis
Baixe no formato PDF, TXT ou leia online no Scribd
The ALS-EMB-EVAL-03 Evaluation Board is a comprehensive aid to understand the capabilities of an advanced micro controller like 8051 compatible Atmel 89C51ED2.
Operation at frequency 11.0592MHz. All the four Ports are terminated at individual four 10pin FRC headers, to interface various onboard circuits as listed below. RS232 compatible serial interface for communication and ISP. Alphanumeric 16x2 LCD display. Six digit 7-segment display interface. 8 LEDs interfaced using serial shift register. 4X4 Keypad. 8 bit Successive Approximation ADC and temperature sensor interface. 8 bit DAC interface. I2C interface to RTC, NVROM SPI interface to 12bit ADC. Four level Elevator simulator interface. On-board stepper motor and DC motor control interface. Solid State Relay and Buzzer interface. RF Receiver and RF Transmitter. IR receiver with remote controller. 8 pin DIP switch interface. Variable frequency and Pulse Width Modulation generator using dual timer. Compare, Capture and PWM demo using on-chip PCA. RS485 and RS422 interface. A number of software examples in `C-language to illustrate the functioning of the interfaces. The software examples are compiled using an evaluation version of KEIL `C compiler for 8051 and a monitor program allows debugging of the user programs in Controller Flash memory.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 2 of 44
1.2 SPECIFICATIONS
The Flash Programmable Embedded Controller Evaluation Board consists of,
The Atmel AT89C51ED2- 8-bit micro controller (U1) with operating frequency of 11.0592MHz with an external crystal and supply voltage of +5V. It has 64K bytes of flash memory block for program and data and 1792 bytes of XRAM The four 10 pin FRC connectors CN1 to CN3 connected to Port-0, to Port-3 of the The on-board interfacing circuits include the study circtuis of the internal features of the controllers such as PWM, SPI, UART, External Interrupts, compare, capture, etc A 9 pin D-type female connector J2 is used for RS232 serial i/o interface for UART experiments and also for flash programming. A 9 pin D-type male Connector J1 is meant for power connection (+5V and GND). A Push button switch SW1 is for Reset and a Slide switch SW2 to select either program mode or run mode. A Push button switch SW27 for External Interrupt /INT0 or /INT1. Eight numbers of LED's (L16 to L23) interfaced through serial shift register 16 switches (SW4 to SW19) organized in 4 rows X 4 columns. 8bit ADC / DAC using I2C device (U14) NVROM - 24C16 - I2C compatible (U16) RTC - DS1307 - I2C compatible (U15) Six numbers of seven segment multiplexed displays (U21 - U26) One Solid State Relay with contact terminated in connector (CN14) One ADC (ADC0809) with a Potentiometer to vary analog input & Temperature Sensor IC LM335 (D14) Elegant enclosure with Test Points for monitoring (TPs)
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 3 of 44
CHAPTER 2 INSTALLATION
2.1 CD Contents : CD basically consists of following folders - AtmelFlip2.4.2 - KeiluV3_EXE - Literatures - Manual - ScreenShots - TestProgs KeiluV3
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 4 of 44 2.2 Block Diagram: RS232 CROSS CABLE POWER CABLE
RS485 CONNECTOR
2.3 Applying Power: After unpacking the system, if no visual damages are noticed use the following procedure to apply power. Connect a 9-pin DSUB Female Connector to a 9-pin DSUB Male connector J1 provided on the Embedded Controller Evaluation Board (ALS-EMB-EVAL-03).The color code for the supply is
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 5 of 44 Pin No Voltages Color Code (Female) 9 VCC(+5V) Orange/White/Blue 4,5 GND Yellow/Black
2.4 System Requirements:
Pentium-class host PC running Microsoft Windows 95/98, NT, 2000, Xp. Tools like KEIL uVision3 IDE, SDCC and Atmel Flip 2.4.2 One working COM port (Eg: COM1) in the host computer system. Hyper Terminal
2.5 Serial Communication Operation:
To connect Embedded Evaluation Board (ALS-EMB-EVAL-03) to host computer system follow the procedure as given below Connect one end of the 9-pin RS232 cross cable (Female Type) to the com port of the host computer system and other end (Male Type) to the serial port connector J2 of the ALS-EMB-EVAL-03 board. Open the Hyper Terminal & set the host computer system baud rate to 9600, data length to 8 bit, parity bit to None and stop bits to 1. Apply power to the board as mentioned in the section 2.3. RS232 Cable Connection: ALS-EMB-EVAL-03 Pin No(9 Pin Male DB) Host Computer Pin No (9 Pin Female DB) 2 (RXD) 3 (RXD) 3 (TXD) 2 (TXD) 5 (Signal GND) 5 (Signal GND)
2.6 Software Installations:
KEIL uV3 IDE Installation - Go to KeiluV3_EXE folder in the CD and run C51v805.exe file. Click Next. - Click on the option "I agree to all the terms of........ and then click Next. - Click Next. - Type name and the mail id and then click Next button, finally click Finish.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 6 of 44 Atmel Flip Installation - Go to Atmel2.4.2 folder in the CD and run setup.exe file. - Give Yes (Software License Agreement) - Click Next (Welcome) - Click Next (Information) - Click Next (Choose Destination Location) - Click Install, and finally click Finish (Setup Complete) button.
2.6 Hyper Terminal Communication Package: After download, connect ALS-EMB-EVAL-03 board to a computer, & open Hyper Terminal of Windows. This allows the user to use computer as a simple display terminal for ALS-EMB-EVAL-03 and to transfer data between computer and ALS-EMB-EVAL-03. To use the Hyper Terminal communication follow the below given steps. - Go to Start menu, select the Programs sub menu, select Accessories --> Communications --> Hyper Terminal. - Give the name for Hyper Terminal you want and then press OK. - The window "Connect To will appear, Select the COM1 in "Connect Using option. - In the window "Port Settings set the settings as Bits Per Sec: 9600 Data bits: 8 Parity: None Stop bits: 1 Flow control: None Then Apply --> OK - Go to "File --> "Save - Bring the Shortcut icon for Hyper Terminal on the Desktop of your computer. Note: Better Restart the system for updating installations.
2.7 Tutorial Software Example softwares to study the features of the ALS-EMB-EVAL-03 board like RTC, NVROM, 4 channel 8-bit ADC/DAC (I2C), 2-channel 12-bit ADC (SPI), temperature sensor, serial communication, elevator interface, relay, etc. are provided in the CD-ROM. And also the data sheets of the related devices interfaced on the board are provided in the CD.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 7 of 44
CHAPTER 3 CONTROLLER SPECIFICATIONS
3.1 AT89C51ED2 Description The AT89C51ED2 contains a non-volatile 64KB on-chip flash program/data memory that is both parallel programmable and serial In-system and In-application programmable. The device supports 6-clock/12-clock mode selection by programming a flash bit using parallel programming or In-system programming. The instruction set is compatible with 80C51 instruction set.
Features 80C51 Central Processing Unit - 64K Bytes On-chip Flash Program/Data Memory - 256 Bytes Scratch Pad RAM - On-chip 1792 bytes Expanded RAM (XRAM)
- In-System Programmable (ISP) Flash memory - 12-clock operation with selectable 6-clock operation (via In-System Programming or via parallel programmer) - On-chip 2048 Bytes EEPROM Block for Data Storage - 100K Write Cycle - Power control modes: - Clock can be stopped and resumed - Idle mode - Power-down mode - Two speed ranges - 0 to 20 MHz with 6-clock operation - 0 to 33 MHz with 12-clock operation - Dual Data Pointers - Four interrupt priority levels - Eight interrupt sources - Four 8-bit I/O ports - Watchdog timer - Full-duplex enhanced UART - Framing error detection - Automatic address recognition - Three 16-bit timers/counters T0, T1 (standard 80C51) and Additional T2 (capture and compare) - Serial Peripheral Interface Module (SPI)
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 8 of 44 - Programmable Counter Array - Asynchronous port reset - Low EMI (inhibit ALE, 6-clock mode) - Wake-up from Power Down by an external interrupt
Serial I/O port:
The serial port in the AT89C51ED2 is compatible with the serial I/O port in the 80C52. It provides both synchronous and asynchronous communication modes. It operates as an asynchronous receiver and transmitter (UART) in full duplex modes (modes 1, 2 and 3). Asynchronous transmission and reception can occur simultaneously and at different baud rates.
Interrupt system: The AT89C51ED2 has a total of 7 interrupt vectors, two external interrupts (/INT0 and /INT1), three timer interrupts (timer0, 1 and 2), the serial port interrupt, SPI interrupt and the PCA interrupt.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 9 of 44 Flash Memory: It contains 64KB program memory organized in 512 pages of 128 bytes. This memory is both parallel and serial In-system programmable.
Features Last 1KB of the flash is used to store the low level in-system programming routines and default serial loader. Boot vector allows user provided FLASH loader code to reside any where in the flash memory space. This configuration provides flexibility to the user. Default loader in boot flash allows programming via the serial port without the need of a user provided loader. Up to 64KB of external program memory in the internal program memory is disabled (EA=0) Programming and erase voltage with standard 5V or 3V VCC supply. Read/programming/Erase Byte wise read (without wait state). Byte or page erase and programming (10ms) Typical programming time (64KB) in 20s
IN-System Programming (ISP): The In-system programming (ISP) is performed without removing the micro controller from the system. The ISP facility consists of a series of internal hardware resources coupled with internal firmware to facilitate remote programming of AT89C51ED2 through the serial port. In order to understand how ISP works, it is necessary to know about two special flash registers; the BOOT VECTOR and STATUS BYTE. At the falling edge of reset, the MCU examines the contents of the status byte. If the status byte is set to zero, power up execution start at location 0000h. When the status byte is set to a value other than zero, the contents of the boot vector is used as the high byte of the execution address and the low byte is set to 00h. The default setting is 0FCh, corresponds to the address 0FC00H. The boot loader can also be executed by holding PSEN low, EA greater than VIH and ALE high at the falling edge of the reset. This is the same effect as having a non zero status byte.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 10 of 44 The ISP programming is accomplished by serial boot loader subroutines found in the BOOTROM. These routines use Intel hex records to receive commands and data from external sources such as host PC.
After programming the flash, the status byte should be programmed to zero in order to allow execution of the user's application code beginning at address 0000h.
The ISP feature allows programming of the Flash EPROM through the serial port. The slide switch SW1 and a pushbutton switch SW2 are provided on the controller board to make the device enter into ISP mode. Procedure for entering into the ISP mode i.e. programming the flash is in detail mentioned in the Chapter 5.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 11 of 44
CHAPTER 4 HARDWARE DETAILS 4.1 CONNECTOR DETAILS: CN1: 9-Pin D-type Male Power connector. Pin No. Description 1,2,3,6,7,8 No Connection 4 GND 5 GND 9 VCC (+5V)
CN1: 10 pin FRC connected to Port-0 of the controller, which can be connected to on board compatible interface circuits. Pin No. Description 1 Port line P0.0 2 Port line P0.1 3 Port line P0.2 4 Port line P0.3 5 Port line P0.4 6 Port line P0.5 7 Port line P0.6 8 Port line P0.7 9 No connection 10 GND
CN2: 10 pin FRC connected to Port-1 of the controller, which can be connected to on board compatible interface circuits. Pin No. Description 1 Port line P1.0 2 Port line P1.1 3 Port line P1.2 4 Port line P1.3 5 Port line P1.4 6 Port line P1.5 7 Port line P1.6 8 Port line P1.7 9 No connection 10 GND
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 12 of 44 CN3: 10 pin FRC connected to Port-2 of the controller, which can be connected to on board compatible interface circuits. Pin No. Description 1 Port line P2.0 2 Port line P2.1 3 Port line P2.2 4 Port line P2.3 5 Port line P2.4 6 Port line P2.5 7 Port line P2.6 8 Port line P2.7 9 No connection 10 GND
CN4: 10 pin FRC connected to Port-3 of the controller, which can be connected to on board compatible interface circuits. Pin No. Description 1 Port line P3.0 2 Port line P3.1 3 Port line P3.2 4 Port line P3.3 5 Port line P3.4 6 Port line P3.5 7 Port line P3.6 8 Port line P3.7 9 No connection 10 GND
J2: 9-Pin D-type Female connector connects to the COM port of host PC for Flash Programming application and transferring the data between controller device and host computer. Pin No. Description 1,4,6,7,8,9 NC 2 RX Line 3 TX Line 5 GND
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 13 of 44 4.2 ON-BOARD INTERFACES:
4.2.1 Slide Switch (SW2):
The slide switch SW2 is used for programming the flash memory. When this switch is in PROG mode on the board the pin /PSEN (Pin-32 of U1) goes low forcing the on-chip boot loader execution. When the switch SW2 is in RUN mode the pin /PSEN is released high through a resistor and user application will be executed.
4.2.2 Push Button Switch: SW1: This push button is connected to the RST (pin-10) of the Microcontroller (U1). It is used to reset the controller device U1. 4.2.3 RS232 Serial Interface: The board has a RS-232 serial communication port. The RS-232 transmits and receives signals that appear on the female 9-pin DB female connector J2. Use a standard RS-232 cross cable to connect the board to the computer's serial port. The controller device AT89C51ED2 (U1) supplies serial I/O data at TTL levels to the MAX232 device (U2), which in turn converts the logic value to the appropriate RS-232 voltage level. The 2-way DIP switch SW3 is used to isolate the MAX232 IC from the microcontroller. When both the buttons of the switch SW3 are towards ON side the MAX232 is connected to the microcontroller, otherwise it is isolated from the microcontroller.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 14 of 44
4.2.4 LCD Interface: A 16X2 Alphanumeric LCD Display with back light is provided along with the ALS- EMB-EVAL-03 board. The LCD interfaced using 4 - bit mode. The connector RM4 details of LCD are as shown in the table below
Connector Pin No. Signal Name Port line 1 GND GND (Ground) 2 VCC (+5V) VCC (+5V) 3 VEE (Preset For LCD Contrast) R9 (10K Potentiometer) 4 RS (Resistor Select) Line P2.7 5 R/W (Read/Write) P2.5 6 EN (LCD Enable) Line P2.6 7 Data D0 No connection 8 Data D1 No connection 9 Data D2 No connection 10 Data D3 No connection 11 Data D4 P2.0 12 Data D5 P2.1 13 Data D6 P2.2 14 Data D7 P2.3 15 VCC (+5V) P2.4 through R11 16 No connection No connection
RS = 0 for sending Command to the LCD RS = 1 for sending Data to the LCD R/W = 0 for reading from the LCD R/W = 1 for writing to the LCD EN = 0 for disabling the LCD EN = 1 for enabling the LCD
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 15 of 44 4.2.5 Six Multiplexed 7- Segment Displays: Interface Diagram: 7-SEGMENT DISPLAY 9 7 5 3 1 10 8 6 4 2 9 7 5 3 1 10 8 6 4 2 CN8 10 PIN FRC 9 7 5 3 1 10 8 6 4 2 9 7 5 3 1 10 8 6 4 2 CN7 10 PIN FRC GND VCC D C B A 9 8 7 6 5 4 3 2 1 0 8 16 12 13 14 15 1 2 3 4 5 6 7 9 10 11 U3 74LS145 R12 10K / G A1 A2 A3 A4 Y1 Y2 Y3 Y4 VCC GND 1 2 4 6 8 18 16 14 12 20 10 U4a 74HCT244DW / G A1 A2 A3 A4 Y1 Y2 Y3 Y4 VCC GND 19 11 13 15 17 9 7 5 3 20 10 U4b 74HCT244DW DC4 0.1uF DC3 0.1uF R13 330E R14 330E R15 330E R16 330E R17 330E R18 330E R19 330E R20 330E E D AN C DP G F AN A B 5 4 3 2 1 6 7 8 9 10 LT543 U22 E D AN C DP G F AN A B 5 4 3 2 1 6 7 8 9 10 LT543 U23 E D AN C DP G F AN A B 5 4 3 2 1 6 7 8 9 10 LT543 U25 E D AN C DP G F AN A B 5 4 3 2 1 6 7 8 9 10 LT543 U26 E D AN C DP G F AN A B 5 4 3 2 1 6 7 8 9 10 LT543 U21 E D AN C DP G F AN A B 5 4 3 2 1 6 7 8 9 10 LT543 U24 NC NC NC NC NC NC GND GND GND GND GND GND GND GND GND VCC VCC VCC VCC VCC VCC EN1 EN1 EN1 EN6 EN6 EN6 EN5 EN5 EN5 EN4 EN4 EN4 EN3 EN3 EN3 EN2 EN2 EN2 B B B B B B B G G G G G G G SEG0 SEG0 SEG1 SEG1 SEG2 SEG2 SEG3 SEG3 SEG4 SEG4 SEG5 SEG5 SEG6 SEG6 SEG7 SEG7 A A A A A A A C C C C C C C D D D D D D D E E E E E E E F F F F F F F DP DP DP DP DP DP DP
7 SEGMENT DISPLAY There are six multiplexed 7-segment display units (U21, U22, U23, U24, U25 and U26) on the board. Each display has 8-inputs SEG-A (Pin-7), SEG-B (Pin-6), SEG-C (Pin- 4), SEG-D (Pin-2), SEG-E (Pin-1), SEG-F (Pin-9), SEG-G (Pin-10) and SEG-H (Pin-5) and the remaining pins pin-3 & pin-8 are Common Cathode CC. These segments are common cathode type hence active high devices. The port lines P0.4 to P0.7 are used to select one of the six digits as shown in the table below. These signals P0.4 to P0.7 are used as inputs to the 74LS145 (U3) and the output lines of the decoder are used as enable lines for six 7-segment displays. The port lines P1.0 to P1.7 are used as segment lines for the six digits through the 74HCT244 buffer (U4). Selection Of seven segment displays: P0.7 P0.6 P0.5 P0.4 Display unit selected 0 0 0 0 U21 0 0 0 1 U22 0 0 1 0 U23 0 0 1 1 U24 0 1 0 0 U25 0 1 0 1 U26
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 16 of 44 4.2.6 LEDs: Interface Diagram: /CLR A B QA QB QC QD QE QF QG QH VCC GND CLK 9 8 1 2 3 4 5 6 10 11 12 13 14 7 U18 74HCT164 R37 10K R38 10K 3mm RED L16 3mm RED L17 3mm RED L18 3mm RED L19 3mm RED L20 3mm RED L21 3mm RED L22 3mm RED L23 1 2 3 4 5 6 7 8 9 SIP7 9 PIN 2K2 SIP DAT3 DAT0 VCC VCC VCC VCC VCC VCC GND
shift register The LEDs L16 to L23 are configured as active low type, i.e. they turn ON to indicate a logical '0' status. The cathode pins of the LEDs are connected to the 8 output lines of 8- bit shift register 74HCT164 (U18) as given in the following table and anodes are connected to +5V VCC through 2K2 resistors SIP7. Port line P1.0 (CLK) is used as clock input to the 8-bit shift register U18 and P0.3 (A) is used as data line. Toggling the 1.0 from '1' to '0' and back to `1 will transfer the data at Port line P0.3 to the first Q o/p of the shift register . Subsequent clocks will transfer the new data at the data i/p to the first o/p while the first o/p is shifted to the second and so on. Connection Details: LED No (Cathode) 8-Bit Shift Register (U5) Pin No. L16 Pin-3 L17 Pin-4 L18 Pin-5 L19 Pin-6 L20 Pin-10 L21 Pin-11 L22 Pin-12 L23 Pin-13
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 17 of 44 4.2.7 Keypad (4 Rows X 4 Columns):
The switches SW4 to SW19 are organized as 4 rows X 4 columns matrix. One end of all the switches are connected to port lines P0.4 - P0.7, which are configured as columns. The other end of the matrix is connected to the port lines P0.0 - P0.3 which are configured as rows. The interface diagram for keypad is shown below.
Operation: Initially take one column line to logic HIGH, then check for each row. If first row is at logic '0' and other rows are at logic '1' then save the read data and compare with the look-up table. Similarly repeat the procedure for all the columns. Keypad Interface: KEYPAD SCAN R E T U R N 1 2 AJIT SW4 IN4148 D4 9 7 5 3 1 10 8 6 4 2 9 7 5 3 1 10 8 6 4 2 CN5 10 PIN FRC IN4148 D5 IN4148 D6 IN4148 D7 1 2 AJIT SW8 1 2 AJIT SW12 1 2 AJIT SW16 1 2 AJIT SW5 1 2 AJIT SW9 1 2 AJIT SW13 1 2 AJIT SW17 1 2 AJIT SW6 1 2 AJIT SW10 1 2 AJIT SW14 1 2 AJIT SW18 1 2 AJIT SW7 1 2 AJIT SW11 1 2 AJIT SW15 1 2 AJIT SW19 KB4 KB4 NC KB3 KB3 KB7 KB7 KB2 KB2 KB6 KB6 KB1 KB1 KB5 KB5 GND KB8 KB8
KEY MATRIX
4.2.8 Temperature Sensor (LM335 U4) & 12-Bit ADC:
The channel-0 of the 8-channel 8-bit ADC device U10(ADC0809) is connected to the preset voltage (POT R42) varying from 0V to 4.5V. The Channel-1 is connected to the Relay mate to feed the analog channel externally(Before feeding any channel make sure it not more than 5V). The temperature sensor device used in this interfacing block is LM335 (D14). The sensor device is connected to the Channel 2 (CH2) of the ADC0809 (U10). The port lines PX.1, PX.2 & PX.3 are used for Channel selection. The circuit diagram for ADC interface is as shown in next page.
ADC Interface 4.2.9 High Current Output Lines and Relay Interface: Any of the 4 ports can be used for High Current applications where a stepper motor, a Dc motor, a solid state relay & a buzzer are interfaced through the high current driver ULN2803. These lines will have high current (max 300 mA) with low voltage level of 0.7V. The Stepper motor can be interfaced to the board by connecting it to the Powermate PM1. The rotating direction of the stepper motor can be changed. The DC Motor can also be interfaced to the board by connecting it to the Relay mate RM9. The direction of the rotation can be changed by changing the position of the slide switch SW26. The Solid State Relay consists of a contact which is terminated in Connector CN3. The same contact is also connected to an LED L26. To use the LED at the contact side of the Solid State Relay short the Jumpers JP7 & JP8. When the relay is energized, LED glows. An active HIGH level at port line will turn ON the relay. The user can check the relay operation by monitoring the contact closure at CN13 /1 & 2 using a multimeter.
The on-board is buzzer will generate sound when the jumper JP6 is shorted.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 19 of 44 Interface Diagram: STEPPER MOTOR & DC MOTOR SOLID STATE RELAY BUZZER 9 7 5 3 1 10 8 6 4 2 9 7 5 3 1 10 8 6 4 2 CN12 10 PIN FRC 1 2 3 4 5 1 2 3 4 5 5WAY ML RELIMATE PM1 3.3e/2.5W R29 R32 22E 5V BZ1 D12 IN4007 D13 IN4007 D 8 I N 4 0 0 7 D 9 I N 4 0 0 7 D 1 0 I N 4 0 0 7 D 1 1 I N 4 0 0 7 + + - - 1 2 3 4 KSD203DC2 SSR 2 5 1 3 6 4 SPDT SLIDE SWITCH SW26 DC13 0.1uF 1 2 CN13 2PIN SCREW CONNECTOR COM IN8 IN7 IN6 IN5 IN4 IN3 IN2 IN1 OUT8 OUT7 OUT6 OUT5 OUT4 OUT3 OUT2 OUT1 GND 10 8 7 6 5 4 3 2 1 11 12 13 14 15 16 17 18 9 ULN2803 U13 2 1 2 1 2WAY ML RELIMATE RM5 12 JP6 2WAY JUMPER 12 JP7 2WAY JUMPER 3mm RED L16 12 JP8 2WAY JUMPER R31 10K R30 2K2 MTR7 MTR7 MTR6 MTR6 MTR5 MTR5 MTR4 MTR4 MTR3 MTR3 MTR2 MTR2 MTR1 MTR1 MTR0 MTR0 VCC VCC VCC VCC VCC VCC GND GND GND
Stepper Motor, DC Motor, Solid State Relay & Buzzer
4.2.10 I2C RTC: The device DS1307 (U15) is an I2C compatible RTC (Real time Clock). I2C protocol is used for writing to and reading data from the RTC device U15. The port lines PX.1 (SDA) and PX.2 (SCL) are used for communication with RTC device. The lithium battery BAT1 is provided to back up the data in the RTC device during power off. The square wave output from the device U5 is monitored at the RM5 Relay mate pin-1. This square wave can be given to the interrupt-0 (/INT0) pin of controller using a 2way Relay mate cable (which has female 2 pin Relay mates on both sides).
Write Operation: Serial data and clock are received through SDA and SCL. After each byte is received an acknowledge bit is transmitted. START and STOP conditions are recognized as the beginning and end of a serial transfer. Address recognition is performed by hardware after reception of the slave address and direction bit (Bit 0 of the Byte). The address byte is the first byte received after the start condition is generated by the master. The address byte contains the 7 bit DS1307 address, which is 1101000, followed by the direction bit (R//W). If this bit is HIGH, it is read, if the bit is LOW, it is write. After receiving and decoding the address byte the device outputs an acknowledgement on the SDA line. When the DS1307 acknowledges the slave address write bit, the master transmits a register address to the DS1307, this will set the register pointer on the DS1307. The master will begin to transmit each byte of data upon the receiving the acknowledgement from DS1307 for each byte. The master will generate a stop condition to terminate the data write.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 20 of 44 Interface Diagram: TO MONITOR RTC THROUGH /INT0 RTC VCC VBAT >SCL >X2 >X1 SQW/OUT SDA GND 8 3 6 2 1 7 5 4 DS1307 U15 X2 32.768KHz LITHIUM 3V CR3202 BAT1 100E R33 R31 10K 2 1 2 1 2WAY ML RELIMATE RM5 9 7 5 3 1 10 8 6 4 2 9 7 5 3 1 10 8 6 4 2 CN14 10 PIN FRC SCL SCL SDA SDA VCC VCC GND GND GND
RTC through I2C Read Operation: The first byte is received and handled as in the slave receiver mode. However, in this mode, the direction bit (Bit 0 of the byte) will indicate that the transfer direction is reversed. Serial data is transmitted on SDA by the DS1307 while the serial clock is input on SCL. START and STOP conditions are recognized as the beginning and end of a serial transfer. The address byte is the first byte received after the start condition is generated by the master. The address byte contains the 7-bit DS1307 address, which is 1101000, followed by the direction bit (R/W) which is 1 for a read. After receiving and decoding the address byte the device inputs an acknowledgement on the SDA line. The DS1307 then begins to transmit data starting with the register address pointed to by the register pointer. If the register pointer is not written to before the initiation of a read mode the first address that is read is the last one stored in the register pointer. The DS1307 must receive a "not acknowledge to end a read. For more detailed information please refer the data sheet available in the CD-ROM.
4.2.11 I2C NVROM: The device 24C16 (U16) is an I2C compatible NVROM (Non Volatile ROM). I2C protocol is used to write and read the data from the NVROM device U16. The NVROM device is of the capacity 16KB. The port lines PX.1 (SDA) and PX.2 (SCL) are used for NVROM device. The NVROM device will retain the data even when the power supply is not present. The interfacing of 24C16 is as shown in figure below. The concept of the I2C interface i.e. Write and read operations is same as in the RTC section. For more detailed information please refer the data sheet available in the CD-ROM.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 21 of 44 Interface Diagram: NVROM 9 7 5 3 1 10 8 6 4 2 9 7 5 3 1 10 8 6 4 2 CN14 10 PIN FRC VSS A2 A1 A0 SDA SCL WP VCC 4 3 2 1 5 6 7 8 24C16 U16 SCL SCL SDA SDA GND GND GND VCC
ADC interface with I2C The device PCF8591 (U14) is an I2C compatible 4 channel 8-bit ADC and one channel DAC output. The four channels are AIN0, AIN1, AIN2 & AIN3 and AOUT is DAC output. The ADC i/p line AIN0 is connected to the 5K pot R39. The same port lines PX.1 (SDA) and PX.2 (SCL) are used for this device.
Write Operation: Serial data and clock are received through SDA and SCL. After each byte is received an acknowledge bit is transmitted. START and STOP conditions are recognized as the beginning and end of a serial transfer. Address recognition is performed by hardware after reception of the slave address and *direction bit (Bit 0 of the Byte). The address byte is the first byte received after the start condition is generated by the master. The address byte contains the 7 bit PCF8591 (U14) address, which is 1001000, followed by the direction bit (R/W) which is 0 for write operation. After receiving and decoding the
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 22 of 44 address byte the device outputs an acknowledgement on the SDA line. The master controller will write control byte (10010000 for AIN0, 10010001 for AIN1, 10010010 for AIN2 & 10010011 for AIN3) to the I2C device for selection of the channels AIN0 to AIN3. The master (U1) will then begin transmitting each byte of data with the PCF8591 (U14) acknowledging each byte received. The master will generate a stop condition to terminate the data write.
Read Operation: The first byte is received and handled as in the slave receiver mode. However, in this mode, the direction bit (Bit 0 of the byte) will indicate that the transfer direction is reversed. Serial data is transmitted on SDA by the PCF8591 while the serial clock is input on SCL. START and STOP conditions are recognized as the beginning and end of a serial transfer. The address byte is the first byte received after the start condition is generated by the master. The address byte contains the 7-bit PCF8591 (U14) address, which is 1001000, followed by the direction bit (R/W) which, for a read, is a 1. After receiving and decoding the address byte the device inputs an acknowledgement on the SDA line. The PCF8591 (U14) then begins to transmit data starting with the device (U14) address pointed to by the register pointer. The PCF8591 (U14) must receive a "not acknowledge to end a read.
4.2.13 ELEVATOR: An elevator presents typical problem to logic designers. A number of situations like the occurrence of simultaneous requests, the assignment of priorities & the logging of requests are frequently encountered.
The control & operation of an elevator within a building, having four floors is simulated by this interface. A key & corresponding RED LED indicator serves as a request button & request status indicator. A row of LEDs indicate the position of the elevator within the shaft. The Green LED when lit indicates that the elevator is at a floor. The servicing of a request can be indicated by clearing the request (turning OFF the request indicator flip-flop).
A four line to 10 line decoder is used to specify the location of the elevator within the shaft. When the four inputs to the decoder are sequenced through the binary codes, corresponding to 0 to 9 with a time interval between transitions, the elevator is seen to move. Two dual D flip-flops are used to sense requests & output the status. A request is cleared through the clear inputs of the flip-flops. The elevator starts at the ground floor &
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 23 of 44 moves up to the top. The requests are sensed each time the lift position is changed. Once the elevator has moved to the top all the requests are cleared.
4.2.13 RS485/422 The RS485 protocol has differential line transceivers suitable for high speed bidirectional data communication on multipoint bus transmission lines. It is designed for balanced data transmission and complies with EIA Standards RS-485 and RS-422. This block contains a differential line driver and a differential line receiver. The receiver is always enabled. The transmit driver has got control to enable or disable. Up to 32 transceivers may be connected simultaneously on a bus(as shown in figure below), but only one driver should be enabled at any time. It is important, therefore, that the remaining disabled drivers do not load the bus. Differential data transmission is used to reliably transmit data at high rates over long distances and
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 24 of 44 through noisy environments. Differential transmission nullifies the effects of ground shifts and noise signals that appear as common-mode voltages on the line.
TYPICAL RS485 NETWORK
The RS-422 standard specifies data rates up to 10 MBaud and line lengths up to 4000 ft. A single driver can drive a transmission line with up to 10 receivers. In order to cater for true multipoint communications, the RS-485 standard was defined. This standard meets or exceeds all the requirements of RS-422 but also allows for up to 32 drivers and 32 receivers to be connected to a single bus
Interface Diagram: RS422 AND RS485 VCC RE DE D GND R B A 8 2 3 4 5 1 7 6 U11 75176 VCC RE DE D GND R B A 8 2 3 4 5 1 7 6 U12 75176 4 3 2 1 RM7 4WAY ML RELIMATE R46 120E R50 120E 1 2 2PIN JUMPER JP2 1 2 2PIN JUMPER JP1 1 6 2 7 3 8 4 9 5 DSUB 9 PIN ST FM J3 NC NC 422_RXD RX+ TXEN 422_TXD TX+ TX- RX- VCC VCC VCC GND GND GND GND GND
4.2.14 RF COMMUNICATION An ASK based RF transmitter & receivers are interfaced to the controller through UART (Tx & Rx) lines, which work at 433.92MHz. This interface operates at the frequency range of 433.92MHz. The communication is established at the baud rate of 2400. Make sure that both the switches of 2way DIP switch SW3 are in OFF condition. This isolates the MAX232 IC from the controller. Now connect the Relay mate RM2 to the Relay mate RM3 with a 4way Relay mate cable(which has female Relay mates on both side). Switch ON both the switches of the SW25 to connect receive line to the receiver and also to provide supply to both transmitter & receiver.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 25 of 44 Interface Diagram: RF RECEIVER/TRANSMITTER TLP434A G N D V C C A N T D A T A I N 134 2 RFTX RF TRANSMITTER 5 6 74HC14D c U9 9 8 74HC14D d U9 R27 10K RLP434A G N D D I G I _ O / P L I N E A R _ O / P + 5 V A N T + 5 V G N D 1 G N D 1 12348 567 RFRX RF RECEIVER 11 10 74HC14D e U9 13 12 74HC14D f U9 4 3 2 1 RM3 4WAY ML RELIMATE R28 10K 1 4 2 3 SW25 2WAY DIP S/W ANTENNA ANTENNA RF_RXD RF_RXD P3.2 RF_TXD RF_TXD VCC N C GND GND GND GND
4.2.15 IR SENSOR The TSOP1730 with operating frequency of 38KHz, is interfaced to the microcontroller through the port line P3.2. Make the connection between the Relay mate RM2 & the Relay mate RM3 with a 4way Relay mate cable (which has female Relay mates on the both sides). Switch ON the second switch of the SW25 to provide the supply to the sensor. The TSOP17 is a miniaturized receiver for an infrared signal from a remote control system. The demodulated output signal from sensor is directly given to the microcontroller. The internal block diagram of the TSOP17 is as shown below.
BLOCK DIAGRAM OF TSOP17
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 26 of 44
4.2.16 DIP SWITCH The 8 sliding DIP switch is interfaced to the port. Each switch can be identified individually by bit operation. The status of the DIP switch can be read from any port & thus read data is displayed on the LCD screen.
4.2.17 PWM The PCA module-2 is configured as PWM. The PWM output will be LOW until CCAPLn is less than the PCA-timer register CL value (i.e until the match occurs). The PWM output will become HIGH once the PCA-timer register CL value crosses the CCAPLn value. It will remain HIGH until next overflow of PCA-timer register CL value occurs. Unlike compare & capture programs where we check for CCFn flag of particular PCA module-n, here in PWM we check only for CF flag, because CCFn flags are set only when a match or capture occurs. The CF flag is set when the PCA counter overflows. The PCA counter is of 16 bit (0xFFFF) & overflows after approximately every 70ms. The period of the PWM wave is 277uS (8bit 0xFF overflow).
4.2.18 Timer0 as counter Timer0 is configured as a 16 bit counter, to measure the frequency of the monostable output of the 556 timer IC. Timer1 is configured as a 50mSec delay generator, which is used to get a delay of 1Sec by waiting up to 20 occurrences of the timer1 interrupt service routine. After every 1Sec the count is updated. This updated frequency (in Hz) of the monostable waveform is displayed in the second line of the LCD screen.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 27 of 44 4.3 JUMPER DESCRIPTION:
There are 8 jumpers provided on the Controller board, the description and their significance are given below. Jumper Significance JP1 Shorting pin-1&2 will connect the termination resistor between Rx+ & Rx- lines. Normally keep open. JP2 Shorting pin-1&2 will connect the termination resistor between Tx+ & Tx- lines. Normally keep open. Shorting pin-1&2 will connect the capture input to the external source through RM8 JP3 Shorting pin-2&3 will connect the capture input to the Monostable multivibrator o/p Shorting pin-1&2 will connect the push button to external interrupt-0 (/INT0). JP4 Shorting pin-2&3 will connect the push button to external interrupt-1 (/INT1). Shorting pin-1&2 will connect the o/p of astable multivibrator to Timer-0(T0). JP5 Shorting pin-2&3 will connect the o/p of astable multivibrator to Timer-1(T1). JP6 Shorting pin-1&2 will connect the buzzer to the controller through driver. JP7 Shorting pin-1&2 will connect the LED L26 to Solid State Relay o/p (+) pin. If kept open, Solid State Relay o/p (+) pin will be connected to CN13-1. JP8 Shorting pin-1&2 will connect Ground to Solid State Relay o/p (-) pin. If kept open, Solid State Relay o/p (-) pin will be connected to CN13-2.
4.4 POWER MATE DETAILS:
PM1: 5 Pin Power mate (High Current Output Lines for Stepper Motor) Pin No. Description 1 OUT1 2 OUT2 3 OUT3 4 OUT4 5 VCC
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 28 of 44 RM2: 4 Pin Reliamate Pin No. Description 1 RXD (P3.0) of AT89C51ED2 (U1) 2 TXD (P3.1) of AT89C51ED2 (U1) 3 /INT0 (P3.2) of AT89C51ED2 (U1) 4 GND
RM3: 4 Pin Reliamate Pin No. Description 1 Digital o/p of RF Receiver after Buffer (U9 pin-12) 2 Transmit line connected to Buffer (U9 pin-5) 3 Vs (pin-2) of the TSOP1738 IR sensor 4 GND
RM7: 4 Pin Reliamate Pin No. Description 1 Receive o/p (pin-1) of 75176 (U11) 2 Driver input (pin-4) of 75176 (U12) 3 Driver enable (pin-3) of 75176 (U12) 4 GND
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 29 of 44 RM8: 2 Pin Reliamate Pin No. Description 1 Provided to feed an external signal for capture 2 GND
RM9: 2 Pin Reliamate Pin No. Description 1 Connected to DPDT switch SW26 pin-2 for DC motor 2 Connected to DPDT switch SW26 pin-4 for DC motor
4.6 TEST POINT DETAILS: Test Points Description GND GROUND TP5 DAC o/p (pin-15) of PCF8591(U14) after buffer(U19) TP6 Capture signal after jumper JP3 selection TP7 Pulse width Modulation output TP8 Output (pin-5) of the Astable multivibrator(U6). TP9 ADC input IN0 (pin-26) of ADC0809 (U10)
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 30 of 44 CHAPTER 5 SOFTWARE DEVELOPMENT DETAILS
The demo programs have been developed using evaluation version of Keil uVision 3 IDE and SDCC (Small Device C Compiler). An In-System Programmer- Atmel Flip 2.4.2-has to be used for downloading programs which are built using Keil uVision3 IDE and SDCC. The entire software setup is to be followed before proceeding further.
Note: It is advised to make backup of the demo programs and other contents of the CD before using.
5.1 CREATION OF NEW PROJECT IN KEILUV3 IDE: 1. Create a project folder before creating project. 2. Open Keil uVision3 IDE software by double clicking on "Keil uVision 3" icon 3. Goto Project menu select New Project and save it after typing a project name in the respective project folder. Click Save. 4. Select device for target window will open, click on Atmel to drop down the menu, then select AT89C51ED2 and press OK. Another window opens asking to add startup files click No button, to not to add a "Startup.a51 file. 5. Right click on Target1 in Project Window & select "Options for Target 'Target1'. In 'Target' field select Xtal(Mhz): 11.0592 Check the box Use On-chip ROM (0x0-0xFFFF), Check the box Use On-chip XRAM (0x0-0x1EFF) In 'Output' window check the box "Create HEX File 6. Go to File menu, click on New to open an editor window. Create your source file(s) and use the header file 'at89c51xd2.h' in the source file and save the file(s). (Color syntax highlighting will be enabled once the file is saved with a recognized extension such as .c ). 7. Right click on "Source Group 1 and select the option Add Files to Group 'Source Group 1' and add the .c source file(s) to the group. 8. After adding source file(s) go to "Project -> "Translate to compile the file(s). 9. Goto "Project - > "Build Target for building all source files such as .c files, .asm files, .h files etc. which have been added to the target build. This will create the .HEX file to be downloaded to the target device.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 31 of 44
5.2 PROGRAM DOWNLOADING:
1. Set the slide switch SW2 to PROG position on the board and press the reset switch SW1. 2. Open the Atmel Flip 2.4.2 tool by double clicking on "Atmel Flip" icon. 3. Goto "Device option -> "Select, select the specific device "AT89C51ED2 & press OK. 4. Goto "File -> "Load HEX File, navigate to desired .HEX file of the project. 5. Goto "Settings option -> "Communication -> "RS232, a window will open, and make sure that no other application is using COM port. Click on COM and select the proper COM port (Eg:COM1), set the baud rate to 115200 and click on Connect. 6. In "Operations Flow region, check the options "Erase, "Blank Check, "Program & "Verify. 7. In right most side of the window select the option BLJB, set the settings BSB, EB, SBV as 00, FF and FC respectively and select the option "Level 0 in Device SSB region.
After selecting all the above click on RUN in field "Operations Flow" and wait until get the status as finished on the status bar. If an error occurs during programming then press SW2 (reset) button and reprogram the device. After programming set the slide switch SW1 towards RUN position on the board and Press SW2 (reset) button to execute the program. If the communication error occurs during the programming then close the Atmel Flip 2.4.2 remove the RS232 cable and reinsert the cable and once again program the device. After programming successfully close the Atmel Flip window.
Caution: Do not reset the device during Flash Programming.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 32 of 44 CHAPTER 6 DEMO PROGRAMS ON THE BOARD
6.1 DEMO PROGRAMS IN KEILUV3 IDE
For all the demo programs make sure that the corresponding connectors are connected and also keep switch sw2 on RUN side & reset the board after every download.
SETUP - Connect CN14 to CN2 using 10 core FRC provided. This project demonstrates the serial shift of a bit, which can be observed from LEDs. All the LEDs L16 to L26 glow one after its previous LED, when all are lit, each LED turns OFF one after the other in the same pattern, then a bit moving across the LEDs can be observed.
The above mentioned connectivity is for the given demo program only. If the user changes the program contents such as assigning different port to a particular interface circuit, then the connections should be made as per the change.
SETUP - Make connections as per the given table using 10 core FRC. CN1 (PORT-0) CN5 (KEYPAD) CN2 (PORT-1) CN8 (7 SEGMENT DISPLAY) CN3 (PORT-2) CN6 (LCD DISPLAY) CN4 (PORT-3) CN7 (7 SEGMENT DISPLAY)
The key pressed will display the corresponding Hexadecimal number on the LCD screen as well as on MSB position of the 7-segment display (U21).
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 33 of 44 The above mentioned connectivity is for given demo program only. If the user changes the program contents such as assigning different port to a particular interface circuit, then the connections should be made as per the change.
SETUP - Connect CN4 (PORT-3) to CN18 of FREQUENCY & PWM GENERATION block using 10 core FRC provided and also short the pin-1&2 of the jumper JP5. Also connect CN3 to CN6 of LCD block. Vary the position of the potentiometer R54 to observe the update of the counts on LCD.
This project configures the Timer-0 into counter mode. The pulses generated by the Astable multivibrator (U6) are fed to the Timer-0 input of AT89C51ED2 (U1). The number of pulses is displayed on the LCD screen continuously. Checkout the wave form at the test point TP8.
The connectivity for this project can not be changed as Timer-0 line of AT89C51ED2 is terminated in PORT-3 (CN4).
4. Serial (UART) Test Project Name: UART_9600.Uv2 File Name: UART_9600.C Path: TestProgs KEILuV3\ UART_9600\
In this program serial port can be tested by checking characters loop back in the Hyper Terminal. Serial initialization has been done in program. Open the hyper terminal and set the Baud rate to 9600. Type the characters from computer keyboard & observe them on the console as well as on the second line of the LCD screen. The string "SERIAL TESTING will be displayed on 1 st line of the LCD continuously. Make sure that both the switches of SW3 are in ON position.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 34 of 44
SETUP - Make sure that pin-1&2 of the Jumper JP4 are shorted. Connect CN2 to CN17 and similarly CN4 to CN18 using 10 core FRC, also connect CN3 to CN6 for LCD interface. When the switch SW27 is pressed the external interrupt will occur and LED L24 will toggle. In this routine INT0 pin of the target device AT89C51ED2 is used as external interrupt. The text message LED TOGGLES UPON EACH EXT INT0 will be displayed on the LCD screen continuously. The connectivity for this project can not be changed as External Interrupt-0 line of AT89C51ED2 is terminated in PORT-3 (CN4).
SETUP - Make connections CN1 (PORT-0) to CN7 of 7-Segment Display block and similarly CN2 (PORT-1) to CN8. When this routine is executed the counting starts from 000000 up to 999999. The counts are displayed on the 7-segment displays U21 - U26. The counter is configured as up counter i.e. incrementing numbers are displayed. The above mentioned connectivity is for given demo program only. If the user changes the program contents such as assigning different port to a particular interface circuit, then the connections should be made as per the change.
7. ALS Standard Elevator Interface Project Name: elevator.Uv2 File Name: elevator.c Path: TestProgs KEILuV3\Elevator\
SETUP - Make connection from CN1 (PORT-0) to CN11 of Elevator block and similarly CN2 (PORT-1) to CN10. Press any of the switches SW21 to SW24 to check out the movement of the control. RED LEDs indicate the request from the floor, GREEN LEDs indicate the current status of the Elevator and YELLOW LEDs indicate the direction of the movement.
The above mentioned connectivity is for given demo program only. If the user changes the program contents such as assigning different port to the Elevator interface circuit, then the connections should be made as per the change.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 35 of 44
SETUP - Make connections from CN2 (PORT-1) to CN14 connector of I2C & SPI block. Also connect CN3 (PORT-2) to CN6 connector of LCD block. This routine can be used to test SPI using the ADC (MCP3202) device present on the board. When this routine is executed, the ADC result (Hexadecimal value) is displayed on the first line of the LCD along with calculated analog voltage in the 2 nd line of the LCD. By varying the Pot R39, user will get different ADC outputs for varying analog voltages from 0 to 5V. This connectivity for this project can not be changed as the on-chip SPI peripheral lines of AT89C51ED2 are terminated in PORT-1 (CN2).
SETUP - Make connections from CN2 (PORT-1) to CN15 connector and CN1 (PORT-0) to CN16 connector ADC block. Also connect CN3 (PORT-2) to CN6 connector of LCD block.
This routine can be used to read the temperature being sensed by the device LM335 (U4) present on the board. When this routine is executed, the temperature in degree Celsius is displayed on the LCD with digital output. Provide little heat to the sensor to observe the temperature variation. The above mentioned connectivity is for given demo program only. If the user changes the program contents such as assigning different port to a particular interface circuit, then the connections should be made as per the change.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 36 of 44 SETUP - Make connections from CN2 (PORT-1) to CN15 connector and CN1 (PORT-0) to CN16 connector ADC block. Also connect CN3 (PORT-2) to CN6 connector of LCD block.
This routine is used to study the interfacing of the ADC0809 (U10) device present on the board. Vary the Pot R42 to get the different ADC o/p values. If the user wishes to monitor his own analog channel, then he can connect the analog signal to the channel-1 of ADC0809 through Relay mate RM6. Make sure that the analog channel selection in the program has to be changed from channel-0 to Channel-1.
The above mentioned connectivity is for given demo program only. If the user changes the program contents such as assigning different port to a particular interface circuit, then the connections should be made as per the change.
SETUP - Make connection from CN2 (PORT-1) to Cn17 connector of the FREQUENCY & PWM GENERATION block.
This program is used to study the varying Pulse Width Modulation (PWM) feature of the microcontroller peripherals. Watch the LED L24 to observe the PWM operation. And monitor the varying pulses at the test point TP7. The connectivity for this project can not be changed as PWM (PCA) lines of AT89C51ED2 are terminated in PORT-1 (CN2).
SETUP - Make connections from CN2 (PORT-1) to connector Cn17 of the FREQUENCY & PWM GENERATION block, also short the pins 2&3 of the jumper JP3.
The monostable o/p of the IC 556 (U6) is given to the capture input of the controller. The positive pulse width of the signal can be captured in this program. The pulse width of the timer output can be varied by varying the potentiometers R54 & R55 correspondingly you can see the varying width at the LCD screen.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 37 of 44 There is an option to select the external signal to feed to the capture input. Short pin - 1&2 of the jumper JP3 & feed the signal at pin-1 of the Relay mate RM8 with respect to the ground pin-2 of the same Relay mate RM8. The connectivity for this project can not be changed as capture (PCA) lines of AT89C51ED2 are terminated in PORT-1 (CN2).
SETUP - Make connection from CN2 (PORT-1) to Cn17 connector of the FREQUENCY & PWM GENERATION block. The PCA module-1 is configured as Compare, to get the compared output at CEX1 (P1.4). The compared output can be observed at LED L25. The compare o/p toggles for every 40mS The connectivity for this project can not be changed as compare (PCA) lines of AT89C51ED2 are terminated in PORT-1 (CN2).
14. RF Communication
SETUP - This demonstration needs two ALS-EMB-EVAL-03 boards. In both the boards carry on the following procedure after completing the program download. a) Connect Relay mate RM2 to the Relay mate RM3 of the RF&IR block on the board. b) After downloading the program, isolate the RS232 block by switching OFF both the switches of SW3. c) Switch ON both the switches of SW25 of Transmitter Board to provide power to the RF & IR block & to connect the transmitter module to Relay mate RM3. d) At the transmitter board side connect the CN4 (PORT-3) to the connector CN18 (marked as PORT3). Short the pins 1&2 of the jumper JP4 to connect the switch SW27 to external interrupt /INT0 pin.(Used to change the transmitting data) e) In the receiver board switch OFF switch-1 of SW25 to disable local transmission.
Project Name: RF_transmit.Uv2 File Name: RF_ transmit.c Path: TestProgs KEILuV3\RF_ transmit\ Download the above program to the board which you want to configure as RF transmitter. The LCD screen will display the text RF TRANSMISSION continuously on its first line indicating that board is configured as RF transmitter. The message to be transmitted will
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 38 of 44 be displayed at the second line of the LCD screen. At the beginning "U will be transmitted continuously to establish the connections. Press push button switch SW27 every time you wish to change the data among the six different text messages. The updated data will be displayed on the LCD screen.
Download the above program to the board which you wish to configure as RF receiver. The LCD screen will display the text RF RECEPTION on its first line indicating that board is configured as RF receiver. The received data will be displayed at the second line of the LCD screen.
SETUP - After downloading the above program, make connections as given below. The demonstration RS422/485 needs to follow the below given procedure, a) Connect Relay mate RM2 to the Relay mate RM7 of the RS422 or RS485 block on the board. b) After program completing the download, isolate the RS232 block by switching OFF both the switches of SW3. c) Connect the male connector which has pin-4 is shorted with pin-8 and pin-5 is shorted with pin-9, to provide the loopback. This arrangement will short the transmit lines to the receive lines. d) Connect CN3 to CN6 of LCD block.
The datum (byte) transmitted is displayed on the first line of the LCD screen. The received data byte is displayed on the second line of the LCD screen. The transmitting data will change automatically in incrementing order. The data includes alpha-numerals and some ASCII characters.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 39 of 44 16. RTC
SETUP - Make connections from CN2 (PORT1) to the connector CN14 (marked as PORT1) of the I2C & SPI block using a 10 core FRC-given along with board. This connects the I2C device RTC DS1307 to the microcontroller through port lines P1.1 (SDA) and P1.2 (SCL) for I2C communication. Also connect Relay mate RM1 to Relay mate RM5 of the I2C & SPI block using a 2-wire Relay mate cable which has both end female Relay mates. This connection will connect the square wave output of the RTC device to the external interrupt /INT1 pin of the microcontroller which is used to read the RTC current data.
When the write operation of the RTC is completed download the above program to read the RTC data. Open the Hyper Terminal to observe the RTC updates and set the baud rate to 9600. Run the program and check out the varying time displayed on the console.
SETUP - Make connections CN2 (PORT1) to the connector CN14 (marked as PORT1) of the I2C & SPI block using a 10 core FRC-given along with board. This connects the I2C
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 40 of 44 device NVROM 24C16 to the microcontroller through port lines P1.1 (SDA) and P1.2 (SCL) for I2C communication When this routine is executed, it will write the values 00 to FF to NVROM one after the other and immediately after write operation the data is read from the NVROM one byte at a time. Open the Hyper Terminal & set the baud rate to 9600 to observe the values 00 to FF.
SETUP - Make connections CN2 (PORT1) to the connector CN14 (marked as PORT1) of the I2C & SPI block using a 10 core FRC-given along with board. This connects the ADC I2C device PCF8591 to the microcontroller through port lines P1.1 (SDA) and P1.2 (SCL) for I2C communication When this routine is executed, the converted digital values for different input analog voltages from the POT R39 are displayed on the Hyper Terminal.
SETUP - After downloading the above mentioned program, connect the Relay mate RM2 to the Relay mate RM3 of the RF&IR block on the board using a Relay mate cable which has both side 4-way female Relay mates. Switch ON the switch-2 of SW25 to provide power supply to the IR sensor. Press 0-9 any key on the remote controller key pad & observe the key pressed on LCD screen second line. If any other key is pressed or the sensor picks noise, the received data will be displayed as X (CROSS).
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 41 of 44 SETUP - Make connection from CN1 (PORT0) to the connector CN9 of DIP SWITCH block using a 10 core FRC given. Also connect CN3 (PORT2) to the connector CN6 of LCD DISPLAY block. Change the switch positions and observe the corresponding changes in the LCD screen.
SETUP - Make connections form CN1 (PORT0) to the connector CN12 of the SSR block using 10 core FRC. Short the pins 1&2 of both the jumpers JP7 & JP8.
In this routine the relay is switched between HIGH and LOW conditions. The LED L26 will toggle for every relay switch over. The high output current lines can also be observed in the CRO through the connector CN13. These current lines will drive the high current pulling devices. The connector CN13 can be used for user applications to interface any other device or circuit, but make sure that the LED L26 is isolated by unshorting both the jumpers JP7 & JP8.
SETUP - Make connections form CN1 (PORT0) to the connector CN12 of the SSR block using 10 core FRC. Connect the Female Powermate of the stepper motor to the male Powermate PM1 present on the board in Stepper Motor block. Also connect CN4 (PORT3) to connector CN18 (marked as PORT3) and short pins 1&2 (marked as /INT0) of the jumper JP4.
Download & run the above program to observe the rotation of the stepper motor. Press the switch SW27 to change the motor rotation direction from clockwise to anti-clockwise and vice-versa.
23. DC Motor Interface Project Name: DCmotor.Uv2 Project File: DCmotor.c Path: TestProgs KEILuV3\DC motor\
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 42 of 44
SETUP - Make connections form CN1 (PORT0) to the connector CN12 of the SSR block using 10 core FRC. Connect the Female Relay mate of the DC motor to the male Relay mate RM9 present on the board in DC Motor block. Download & run the above program to observe the rotation of the DC motor. Change the position of the switch SW26 to change the DC motor rotation direction from clockwise to anti-clockwise and vice-versa.
SETUP - Connect CN1 (PORT0) to the connector CN12 of the SSR block using 10 core FRC. Short the pins -1&2- of the jumper JP6. Download & run the above mentioned program to observe the audio output of the buzzer BZ1.
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 43 of 44
CHAPTER 7 TROUBLE SHOOTING
1) SERIAL COMMUNICATION / DOWNLOAD If serial communication or download could not be established properly then check out whether the following conditions are met a) The cable used for communication should be cross cable not 1:1. b) The two switches of SW3 should be in ON position. c) The switch SW2 should be in RUN mode when the program is executing & it should be in PROG mode during download. d) Make sure no other interface circuit is connected to PORT3 (CN4). e) Relay mate RM2 is not connected to any other relay mate. f) IC MAX232 is in good condition.
2) RS485 If RS485 communication could not be established properly then check out the following conditions, a) Pin-4 with pin-8 and similarly pin-5 with pin-9 of connector J3 are shorted. b) There should be a connection between RM2 to RM7. c) Make sure no other interface circuit is connected to PORT3 (CN4).
3) EXTERNAL INTERRUPT Check out jumper JP4, whether proper interrupt source is selected also make sure that CN4 is connected to CN18.
4) RF COMMUNICATION To establish good RF communication between two boards, a) Make sure RM2 & RM3 are connected b) Proper antenna is mounted - transmit antenna for RF transmitter & receive antenna for RF receiver. c) Both the switches of SW25 are in ON condition. d) Make sure no other interface circuit is connected to PORT3 (CN4).
5) IR SENSOR
A AL LS S- -E EM MB B- -E EV VA AL L- -0 03 3 ADVANCED ELECTRONIC SYSTEMS 44 of 44 For proper IR sensing make sure RM2 & RM3 are connected & Both the switches of SW25 are in ON condition. Switch off FAN or Tube light if it is picking up noise.