TRANG 7 TRANG 8 VII CONTENTS AT A GLANCE PART I MICROCONTROLLERS _1_ CHAPTER 1 INTRODUCTION TO MICROENGINEERING LABS’ LAB-X1 EXPERIMENTAL BOARD _3_ CHAPTER 2 GETTING STARTED _13_ CHAPTER[r]
8-bit Conversion Circuit A test circuit to demonstrate 8-bit conversion and display is shown in Figure 7.1. The 16F877 MCU has eight analogue inputs available, at RA0, RA1, RA2, RA3, RA5, RE0, RE1 and RE2. These have alternate labels AN0–AN7 for this function. RA2 and RA3 may be used as r[r]
A specific type of op-amp is normally used for this type of application, which has an open collector output. The output transistor switching circuit has to be completed by an external pull-up (load) resistor. This allows the output switching voltage to be different from the comparator supply volta[r]
On the other hand, it is convenient in microprocessor systems to use the same single supply used by the digital circuits, ⫹ 5 V, and to avoid the need to provide separate dual op-amp supplies. Some op-amps are designed specifi- cally to operate with a single supply, such as the LM324 type[r]
We will assume initially that the MCU is transmitting. The sender and receiver have to be initialised to use the same baud rate, number of data bits (default 8) and number of stop bits (default 1). The transmit (TX) output is high when idle (external line negative). When the serial buffer register ([r]
; LABEL EQUATES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; INCLUDE "C:\BOOK2\APPS\P16F877A.INC" Char EQU 30 ; Display character code Num1 EQU 31 ; First number input Num2 EQU 32 ; Second number input Result EQU 33 ; Calculated result Oper EQU 34 ; Operation code store Temp E[r]
Integer An 8-bit location can only store numbers from 0 to 255 in binary. This is an obvious limitation in programs that may need to calculate results up to say, four significant decimal digits (0–9999), with negative as well as positive numbers. 16-bit integers can represent decimal[r]
GOTO scan ; Convert binary to BCD ................................... outres MOVF Result,W ; load result MOVWF Lsd ; into low digit store CLRF Msd ; high digit = 0 BSF STATUS,C ; set C flag MOVLW D'10' ; load 10 again SUBWF Lsd ; sub 10 from result
CLOCK A standard crystal circuit is used, running at 4 MHz. This gives a 1 s in- struction execution time, which is convenient for analysing program timing. The crystal needs to be physically near the MCU, so that additional track ca- pacitance does not prevent the crystal from oscillatin[r]
The arithmetic processing should be straightforward, as only single digit numbers are in use. The temperature will be read in as an 8-bit number in the range 0 ⫺ 200. This should be divided by 10 (see Chapter 5) to obtain a num- ber in the range 0 ⫺ 20; subtract 4 to calc[r]
The bus system operation depends on the presence of tri-state buffers at the output of the RAM chips. These can be switched to allow data input (!CE & !WE ⫽ low), data output (!CE & !OE ⫽ low) or disabled (!CE & !OE ⫽ high). In the disabled state, the outputs of the RAM are eff[r]
In this circuit, a relatively small offset voltage is required, and it is obtained by taking the forward volt drop of a standard signal diode (about 0.7 V) and di- viding it down to around 100 mV. A fine adjustment of this is then obtained by ‘squeezing’ the diode voltage via its current supp[r]
The change in the resistance is rather small, maybe less than 1%. This sits on top of an unstrained resistance of typically 120 . To detect the change, while eliminating the fixed resistance, four gauges are connected in a bridge arrange- ment and a differential voltage is measured[r]
The inkjet printer provides a good example of a position system. A plastic strip with a fine grating is used to provide position feedback for the print head. The simple periodic grating can be made more precise by grading the light transmission sinusoidally over a cycle, allowing calculation of frac[r]
w w w. n e w n e s p r e s s . c o m The book is organized in five parts. Part 1 includes an overview of the PIC microcontroller internal architecture, describing the features of the 16F877A specifically. This chip is often used as representative of the 16 series MCU[r]
Another spur to writing this book has been the development of the interac- tive design software which has made the job of learning and teaching elec- tronics that much more enjoyable. The Proteus software used in this book has been developed by a talented team at Labcenter Elect[r]
After each output, a 1 ms delay is executed to allow the LCD controller time to process the input and display it. An exact timing loop (Onems) is achieved by padding the delay loop to 4 cycles with a NOP, and executing it 249 times. With the additional instructions and subroutine jumps, the delay is[r]
8 In I 2 C, a control code and address must be sent before the data, making up to 5 bytes in all, plus control bits. In SPI, only data bits are sent as the slave device is selected in hardware (slave select). 9 It holds the SDA line low for a bit cycle, which is[r]