Interactive Modules for the Intelligent Teddy Bear

Size: px
Start display at page:

Download "Interactive Modules for the Intelligent Teddy Bear"

Transcription

1 Interactive Modules for the Intelligent Teddy Bear Submitted by: Siddharth Goyal Department of Electrical Engineering Under the Guidance of Dr. Shuzhi Sam Ge Prof. of the Electrical and Computer Engineering Department National University of Singapore SINGAPORE 1

2 Abstract This paper explores the different ideas to make the teddy bear more intractable and sociable with the human being. We are developing a sociable teddy bear and we have also implemented the different modules on it. Some modules like handshaking, nuzzling and voice and the different ways to implement these modules will be discussed in detail. Also, new possible advancements and ideas are discussed to implement the handshaking and to make it more intractable. Keywords : Handshaking, Nuzzling, intelligent, interactive, teddy bear, micro-controller 1 Introduction In the field of human computer interaction, it has been shown that human treat computer as their friend as like other persons. This friendly nature with computers leads the human to develop the robots as a friend. These robots are different from task-oriented robots, such as industrial robots, which perform particular tasks in limited areas. These are sociable or interaction-oriented robots which are designed to communicate with humans and will be able to participate in human society. We are trying to develop such an sociable intelligent robot that will be able to interact with you as a person. This robot can be divided into the different modules as: 1.1 Voice(Expressive) Purpose- To communicate to the user the current state of the robot or as a feedback to the user on the user s actions. Human-Robot Interactions (Triggers)-Any actions which requires the robot to speak/ express itself. Robot Reactions-Different words will be spoken based on the intended reply/feedback. Realization -A database of recorded words (initial stage/prototyping) or using a text to speech software. 1.2 Touch (Passive) Purpose-To detect the physical contact with the user. Human-Robot Interactions (Triggers)- Smacking the robot Robot Reactions-Change internal emotive state, Possible reactions depends on the robot current emotion state and personality, Make sounds to show discontent or to inform user to stop (Voice), Using hands to make warding/begging actions (Body language), Facial expression to show new emotive state sadness/fear/anger (Facial expressions) Realization -An inflated balloon attached to a pressure sensor. The changes in the air pressure will indicate the force the user is applying on the robot 2

3 1.3 Music (Expressive) Human-Robot Interactions (Triggers)- Recognizes the sound (e.g. play a music ) Robot Reactions- A database of recorded music tracks. Can you 1.4 Vision (Passive) Human-Robot Interactions (Triggers)- Facial recognition Robot Reactions- Express its own behavior according to the response. 1.5 Body Language (Expressive) Purpose- The robot will use its body language to express the current emotions of the robot. Human-Robot Interactions (Triggers)- Any actions that require the robot to display emotions or convey messages using its body language Robot Reactions- Depending on the message and emotions to convey, the robot goes through a series of motions or maintain a certain position Realization - A number of DC/servo motors provide the head, arm and waist motions to achieve the required body language. The following actuations are identified: 2 DOF for each arm and 2 DOF for the neck for a total of 6 DOFs 1.6 Sound Localization (Passive) Purpose- To remain in eye contact with the user interacting with the robot which will enhances the interaction experience for the user. Human-Robot Interactions (Triggers)-Speaking/clapping of hands by the human Robot Reactions- Moving the servo motors servings the neck, the robot faces the direction of the person generating the noise Realization -Embedding three microphones in the head to record sounds from the front, left and right. The robot computes the direction of the sound based on the difference between the sound recorded by the three microphones. 1.7 Facial Expressions Purpose- The robot will use its facial expressions to show the current emotions of the robot. Human-Robot Interactions (Triggers)- Any actions that require the robot to display emotions using its facial expression. 1.8 Hearing (Passive) Purpose- Recognizing and understanding the words spoken by the human to establish a meaningful conversation. Understanding the spoken words and sentences are the basis for establishing a meaningful conversation or Recognizing the person speaking to the robot through the characteristics of the person s voice. Human-Robot Interactions (Triggers)- The person speaks to the robot Robot Reactions- The robot based on the recognized words/sentences, makes a suitable reply or If a match occurs the robot will be able to greet the person 3

4 by the person s name. If there is no match, the robot should request for the person s name and keep a record for future interactions. 1.9 Bluetooth Communication Purpose-It is knowledge based communication used to transfer database, technology etc via bluetooth communication. This communication can be between computer and bear or it can be between two bears Human-Robot Interactions (Triggers)-Taking the bear near the computer and activating the bluetooth device Handshaking (Passive) Purpose- Recognizing that person wants to shake hand Human-Robot Interactions (Triggers)- Pressing both sides of the hand Robot Reactions- Shake hand until person leaves your hand (but limited to some fixed numbers) 1.11 Nuzzling (Passive) Purpose- Recognizing if person takes any object near its nose or if he touches his nose Human-Robot Interactions (Triggers)- Taking any object near the nose Robot Reactions- Rotate its head in clockwise and anticlockwise direction 1.12 Alarm (Expressive) Purpose- The robot reminds the person about the alarm set by him Human-Robot Interactions (Triggers)- Alarm time can be set by the LED displays and then it can be transferred to the micro-controller Robot Reactions- Playback of pre-recorded sound at the time of alarm 1.13 Event Reminder (Expressive) Purpose- Reminding the person about the particular event Human-Robot Interactions (Triggers)- Reminder can be set using LED displays and recording the sound of the person Robot Reactions- Speak the same sound which was recorded by person during the reminder setup In this paper some modules like handshaking, nuzzling and voice will be discussed in detail. Basically handshaking is the first step to interact with the person. If someone meets you first time, then he will put his hand forward to shake with you and then he will introduce himself. So same is the case with teddy bear. Also, if you touch the robot or perform any action on the robot then it should be capable of showing some response. Response can be expressive 4

5 (voice) or passive. If bear does not respond it will be considered as dead. So all these modules will help in making the bear more intractable and intelligent. A lot of research has already been done on the robots to make them more intractable so that they can easily communicate with others. As a result of it, many humanoid robots has been developed. In the (Hirai, Hirose) the humanoid robot has been made to communicate with others. This robot has the capability to move in backward, forward, sideways and diagonal positions. A humanoid robot (Kanda, Ishiguro) has also been developed to understand the people gestures and responding to them, it looks like they are communicating with person. To behave more sociably a robot (Nakauchi and Simmons, 2002) is also developed which employs stereo vision to recognize lines of people, and uses the concept of personal space for modeling the social behavior. In MIT lab also, robot named Kismet (Breazeal, 2003) has been developed which has the expressive behavior and also able to recognize the effective intent through tone of voice. SONY has also developed a pet robot AIBO which has the ability to walk, see the environment via camera and able to recognizing the spoken commands. Apart from the above developments, many scientists had also done work on handshaking or hand movement of the robots. In (Kanda, Ishiguro) also a method is developed for analyzing the human-robot interaction by hugging, handshaking, paper-scissor work and exercising. In the (Shimizu, Koizumi) robot is developed which is capable of playing with the movement of its hands. Now in MIT Artificial Intelligence Lab, there are ongoing projects on the sociable robots and interactive robot theater. More scientists are are also researching to advance the sociable interactions with the robots. 2 Implementation 2.1 Handshaking Handshaking module is divided into two parts which will be discussed below Remote Control Movement In remote control movement, if you shake the hand of one bear the correspondingly hand of second bear will also move up and down. The basic purpose of this type of movement is to give same type of effect at some other location. In the (Shimizu, Koizumi), they have implemented the same thing for the playing purpose. If someone wants to shake hand with you and you are far away from him. This data can be sent through internet and same effect can be felt at distant location. It is important to note that this is not limited to hands only. It is also applicable to other parts of the bear. The basic idea of implementation of this technique is given in Figure 1. The movement of second bear s hand will be similar to the movement of the hand of the first bear. The block diagram of the implementation of this remote handshaking is given in the Figure 2. As seen in the block diagram in Figure 2, an analog input signal is given. This analog signal is the movement of hand of first teddy bear which will be given manually. Basically movement of hand is the rotation of the variable resistor. If you vary the hand by 90 5

6 Encoded Signal Transmitter Receiver Human Hand Shaking as Input Second Bear Hand Movement as Output Figure 1: Basic Idea for Implementation of Remote Control Hand Movement INPUT SIGNAL A/D CONVERSION ENCODING TRANSMITTER HAND MOVEMENT SERVOMOTOR DECODING RECEIVER Figure 2: Block Diagram for Implementation of Remote Control Hand Movement degrees then variable resistor will also rotate by 90 degrees. This position of hand will be given micro-controller which is already programmed. In this case, two micro-controllers are used, one for the transmitter side (in first teddy bear) and another for the receiver side (in second teddy bear). Both micro-controllers are programmed and the program files are given in the Appendix. Then signal (which is the position of hand of first bear s hand) is send to A/D convertor which will convert it into the digital form. This digital signal is transmitted to the receiver of the other micro-controller. Before transmission, encoding is also done. The purpose of the encoding is to remove the unwanted or noise signals. Here Manchester encoding is used on the last three bits and initial two bits are kept same. After transmission, data is received on second side of the bear which is further decoded into the original signal and if signal is not of the Manchester type then it is considered as noise and it is ignored. This decoded signal is the position of the first teddy bear s hand. The decoded signal is used to produce PWM pulse to the servomotor. Servomotor has degrees of possible rotations and it rotates the hand of bear same as the first one. This is how remote control movement is done. 6

7 2.1.2 Direct Handshaking This handshaking is relatively simpler than the remote handshaking. In this method, bear shakes hand with person if person presses its both sides of hands. Here there is no need of the A/D convertor and also no need of transmitterreceiver part. It can be done on one micro-controller.the block diagram of the implementation of this direct handshaking is given in the Figure 3. As seen in the above block diagram, if person presses both sides of the teddy PRESSING HANDS SWITCHES MICRO CONTROLLER SERVOMOTOR HAND MOVEMENT Figure 3: Block Diagram for Implementation of Direct Handshaking bear s hand then both the switches will send a signal to activate the shaking process. As there is no transmitter receiver part, so encoding or decoding is also not required. After getting activation from the switches micro-controller will send generate the PWM signal which will be supplied to the servomotor (i.e. one time it is 26 and with some delay it comes back to 0). Here 0 and 26 are the extreme positions. It can be decreased if we need the less degree of rotations. So this lead to the direct handshaking motion of the teddy bear. In practice, if a person meets you and shakes hand with you. You will shake hand until he leaves your hand. But if he still holds your hand then you will stop after certain number of shaking. So this problem has also been taken into consideration. If you hold hand of bear for more than four shaking, then it will stop and won t continue further. If you want to shake hand with the bear again then once you have to leave its hand. So this makes the bear more live, intelligent and more practical to the real life situations. 2.2 Nuzzling Nuzzling is a small module to drive the robots towards sociability. We have implemented the nuzzling on the teddy bear. In our case if you take your hand or any object near its nose or if you touch it, it will cause the bear to rotate its head. Initially its head is in the middle position, but after sensing the object nearby, it will rotate its head in the clockwise and anticlockwise direction. The basic block diagram of implementation is given in Figure 4. INPUT SIGNAL (Object taken near the nose) SENSOR MICRO CONTROLLER SERVO MOTOR NUZZLING Figure 4: Basic Idea for Implementation of Nuzzling In the block diagram, it is shown that the input signal is given to trigger the sensor. We are using the IR proximity sensor, which has the detection range of 0-60 mm. The sensor will be triggered only if any object is taken near the 7

8 nose of the bear (i.e within the range of 0-60 mm). If sensor is activated, it will send the analog signal to micro-controller. Analog signal will be converted into the digital signal using A/D conversion. Micro-controller is programmed and the programming files are given in the Appendix. Micro-controller sends the signal to the servo motor. Servo motor is kept initially at the central position so that it can move in both the clockwise and anticlockwise directions. This whole process leads to nuzzling. Nuzzling will continue until you take the object away from its nose. The bear s head will stop at center position if you take away the object. This process is similar to the direct handshaking discussed in Section Both uses only one micro-controller and one servo motor. But in this case, servo motor is more strong as compared to the motor used in the handshaking because it has to handle the weight of teddy bear s head also. 2.3 Voice(Expressive) This module will discuss the desired response from the robot according to the user actions. Response is in the form of the voice which is basically the playback at different user actions. The block diagram of this implementation is given in Figure 5. USER ACTION SENSORS VOICE CHIP PLAYBACK Figure 5: Basic Idea for Implementation of Playback Voice Messages It is clear from the block diagram that input is given to the robot which depends on the user action (i.e. touch etc.). After getting the signal from the sensor, this signal will be sent to voice chip where different type of voice message are recorded at different addresses. These addresses corresponds to combination of different sensors. A signal will be sent by voice chip to the speaker and playback will be switched on. This module can also be coupled with the handshaking module. For example, during handshaking it can also produce playback message (i.e. Hello. How are you? ). This module can also be helpful in the event reminder module e.g. it can record the message or about the event from the user and the same message can be spoken at the time of event. Although it is not a very big module but it is helpful in accomplishment of different type of modules which will make the teddy bear more interactive and intelligent. 3 Future Aspects Implementation of handshaking described in the Section 2 is valid only if a person takes his hand and presses both sides of the teddy bear hands. This is relatively easier way of hand shaking. But there can be some other ways also which are more complex as compare to previous one. One possible way is that it should detect the hand at some distance and then it should move his hand towards the person s hand (i.e. it should measure the distance from hand and then move its hand accordingly). But the complication in this technique is that, it is hard to know the intention of the person wether he really wants 8

9 to shake hand or he is taking his hand near to bear for other purpose. Other way of implementing the handshaking is using the video cameras or the RYD technique. So there is still much scope in the advancement of this module. 4 Other Considerations Apart from the above modules described in the Section 1, there can be other possible advancements in the modules which will try the bear to become more sociable and intractable. 4.1 Sensitive Skin Like the human being, the skin of the bear should be sensitive to the any activity carried out on its skin. Its skin should detect wether somebody is touching it or anything happening near the bear. There should also some reaction from the bear if something like that happens. If someone touches then it must feel the type of touch. On this basis touch can be divided into the soft and hard touch. Some of the desired effect and cause are given in Table 1. Table 1: Cause and Effects Action Level of the Action Desired Output Touch Soft Voice ( Nice to Feel ) Touch Hard Voice ( Disgusting ) Push - Voice ( Don t Push ) Another thing which can be implemented is that it should be sensitive about the changing environmental or weather conditions. Here temperature range can be selected for the proper response from the bear if there is change in the surrounding weather conditions. These temperature ranges are given in Table 2. Table 2: Temperature Ranges Temperature Range (Celsius) Desired Output from Bear 0-10 Voice ( Its very cold ) Voice ( Its cold ) Voice ( Feeling good ) Voice ( Feeling warm ) Voice ( Its too hot here ) 4.2 Path Tracking We have already completed a module on sound tracking. In that module if we move the sound source near the bear, it causes the bear s face to rotate in the same direction to provide attention to speaker. This module can help in further advancement for tracking the path. If someone calls the bear then it should be capable to reach the destination from where sound is coming. This is also the major part of the sociable behavior. For the explanation of this technique, 9

10 three different cases are taken with increasing their difficulty level. First case is shown in left side in Figure 6. It is clear that this case is the simplest case as there is no deflection in the path. If some one calls the bear, it will directly reach it without any hinderance. Second case is on the right side of Figure 6. This case is also easy but difficult as compared to the first one. Sound Source Sensors Teddy Bear Sound Source Sensors Teddy Bear Junction 1 Figure 6: Different paths to track the sound After hearing the sound, it will be able to get the direction of sound (as module on sound tracking is already completed). There is not a straight path to go to track the sound, so it will find the path which increases the intensity of sound. In this case, initially it will move to right as it knows that sound is coming from right half of plane. After reaching the junction 1, it will stop and again detect the source of sound. It knows that it is in upper half, so it will go upwards thus finding the source of sound. Third case is shown in Figure 7 which is relatively more complicated as compared to others. Here the dotted line shows the path followed by the bear to track the sound source. There are sensors used at different positions of bear. If someone calls the teddy bear, sensors in the direction of sound will act first and they will check the availability of path available in that direction. But if there is no path available in that direction then sensors at different positions will work. In this case, initially it will go to junction 1 and stores the position of junction 1. At junction 1 there is available path in the upward direction (i.e. towards the sound source), it will go there. But that route is blocked which forces the bear to come back to junction 1. Now it removes the option of going upwards only at junction 1. In this way it will find the next suitable path. So using this algorithm it can find the exact location of source and will be able to trace it. 10

11 Sound Source Sensors Teddy Bear 1 Figure 7: Complex path to track the sound References C. Breazeal, Emotion and sociable humanoid robots, E. Hudlika (ed), International Journal of Human-Computer Studies, 59, pp , K. Hirai, M. Hirose, Y. Haikawa, and T. Takenaka, The development of Honda humanoid robot, Proc. IEEE Int. Conf. on Robotics and Automation, T. Kanda, H. Ishiguro, M. Imai, and T. Ono, Body Movement Analysis of Human-Robot Interaction, International Joint Conference on Artificial Intelligence (IJCAI), pp , Aug T. Kanda, H. Ishiguro, T. Ono, M. Imai, and R. Nakatsu, Development and Evaluation of an Interactive Humanoid Robot Robovie, IEEE Int. Conf. on Robotics and Automation, pp , Y. Nakauchi and R. Simmons, A Social Robot that Stands in Line, Autonomous Robots, Vol. 12, No. 3, pp. 313 C 324, Noriyoshi Shimizu, Naoya Koizumi, Maki Sugimoto, Hideaki Nii, Dairoku Sekiguchi, Masahiko Inami, Teddy-bear based Robotic User Interface, Proceedings of ACM SIGCHI International Conference on Advances in Computer Entertainment Technology ACE 2005, pp., Jun

12 Appendix: Programming Files Handshaking The Programming files for the remote handshaking for both the transmitter and receiver part is given below. For the Transmitter Part #include < pic1687x.h > Used for the specific range of operation/transmission of the data int flag1,flag2; Used in the Manchester coding int j,b,me,l,me1; For storing the data after analogue to digital conversion unsigned char dataentry = 0; Initialized as no value stored Interrupt routine runs when an interrupt occurs (many type of interrupts and all will run this) void interrupt isr(void) main() Initialize all the variables and flags to the starting position maxflag=0; flag2=0; b=0; flag1=0; / Assign Port A,C as input port and D,B as the output port. TRISA = 0xFF; TRISC = 0xFF; TRISB = 0x00; TRISD = 0x00; Initialize all the Ports PORTA=0; PORTB=0; PORTC=0; PORTD=0; Setup the A-D convertor ADCON0 = 0b ; ADCON1 = 0b ; For the transmitter SPBRG = 129; Set baud rate to 9.6K 12

13 BRGH = 1; Set high speed baud rate SYNC = 0; Set asynchronous mode SPEN = 1; Enable serial port TXIE = 0; diable interrupts TX9 = 0; TXEN = 1; while(1) ADGO = 1; while (ADGO) continue; Waits for A/D module reading if(adgo==0) dataentry = ADRESH; Scaling the input into the equivalent motors positions if(dataentry >=128) b = (dataentry * (dataentry else b = 0; Manchester Encoding Last three bits are encoded via Manchester coding Initial two bits remain same me = 0; for (j=0 ; j<3; j++) me >>=2; l= b; l= l & 0b ; if (l==0b ) me = me + 0b010000; 0 >1 else me = me + 0b100000; 1 >0 b >>=1; b<<=6; me1 = me +b; while (!TXIF) continue; Waits for transmitter flag to set 13

14 if(txif ==1) TXREG = me1; For the receiver part #include < pic1687x.h > For the generation of the PWM signal int counter1; Determines the current count of the PWM cycle. Counts to the PWM period int compare; For the decoding part unsigned char dataentry,datareceived,datareceived1,datareceived2; unsigned char i,dec,enc,pattern; Flag for the rejection of noise signal int flag1; void interrupt isr(void) Checks the timer 1 interrupt flag make sure it is the correct interrupt. if (TMR1IF) Modules based on the timer interupts Resets the timer 1 (Start counting again for next period) TMR1IF=0; TMR1ON=0; TMR1H=0xFF; TMR1L=0x3C; TMR1ON=1; / Motor Drive Module / Produces the PWM signals required by the motors if( compare < counter1) RD0 = 1; RD0 is ports that produces the PWM signal to motor1 else RD0 = 0; counter1++; / Increments the counter for the PWM period PORTB = (compare-472); 14

15 if(counter1>=512) counter1 = 0; Resetting the counter RD0 = 1; main() / Initialize all the variables and flags to the starting position datareceived = 0; datareceived1=0; counter1 =0; dec =0; flag1 = 0; Setup the A-D convertor ADCON0 = 0b ; ADCON1 = 0b ; / Assign Port A,C as input port and D,B as the output port. TRISA = 0xFF; TRISC = 0xFF; TRISD = 0x00; TRISB = 0x00; Initialize the output ports PORTB = 0; PORTD = 0; For the receiver SPBRG = 129; Set baud rate to 9.6K BRGH = 1; Set high speed baud rate SYNC = 0; Set asynchronous mode SPEN = 1; Enable serial port RCIE = 0; diable interrupts CREN = 1; Enable reception RX9 =0; Disable 9 bit reception PEIE=1; Enables interrupts for CPU GIE=1; 15

16 TMR1CS=0; T1CKPS0=0; T1CKPS1=0; Setup the timer 1 module to the required specs configurations TMR1ON=0; Stop timer 1 TMR1H= 0xFF; Sets number of bits to count (Basically the length between interrupts) TMR1L= 0x3C; TMR1ON=1; Start timer 1 TMR1IF=0; Clear interrupt flag TMR1IE=1; Enables timer 1 interrupts while(1) while(!rcif) continue; Receiver module processes if(rcif ==1) Checks the receive flag if(oerr ==1) Checks for overflow error and re-init receiver CREN = 0; CREN = 1; Reads from the receiver module datareceived = RCREG; Manchester Decoding Decode the last three bits and add it with two initial bits enc = datareceived; for (i=0; i<3; i++) dec >>=1; pattern = enc & 0b11; if (pattern == 0b10) 1 dec = dec+ 0b100; 16

17 else if (pattern == 0b01) 0 dec = dec + 0b000; else flag1 = 1; Setting the flag for the noise signal break; enc >>=2; datareceived2 = datareceived & 0b ; datareceived2 >>= 3; Check wether received signal is correct one or noise signal if(flag1 == 0) datareceived1 = dec+ datareceived2; dataentry = datareceived1; Scaling of the received signal (range in which motor works) if(dataentry < 28) compare = 472+ dataentry; else compare = 472; Starting range of motor Nuzzling The programming file for the nuzzling is given below: #include <pic1687x.h> Used for the specific range of operation/transmission of the data int flag1,flag2; unsigned char data entry; for the required time delay to change the position of motor 17

18 unsigned int counter1=0; Counter for motor PWM signal generation unsigned int counter2=0; Interrupt routine runs when an interrupt occurs (many type of interrupts and all will run this) void interrupt isr(void) if (TMR1IF) Checks the timer 1 interrupt flag make sure it is the correct interrupt. Modules based on the timer interrupts Resets the timer 1 (Start counting again for next period) TMR1IF=0; TMR1ON=0; TMR1H=0xFE; TMR1L=0x79; TMR1ON=1; / Motor Drive Module / Produces the PWM signals required by the motors counter1++; if(counter1>=2816) To provide the sufficient delay in changing the signal if(rc0==1) Checks the condition from the sensor if(flag2 == 0) Checks the position of head b1=b1+7; Take motor to extreme right position else b1=b1-7; Take motor to extreme left position counter1 = 0; Reseting the counter if(b1>=50) For the extreme right position flag2 =1; if(b1 =36) For the extreme left position b1=36; Extreme Left position of head flag2=0; 18

19 else b1=43; Center Position of head PORTB = b1; Display output to PORT B if( b1 counter2) RD0 = 1; RD0 is ports that produces the PWM signal to motor1 else RD0 = 0; counter2++; / Increments the counter for the PWM period if(counter2>=255) counter2 = 0; Resetting the counter RD0 = 1; main() / Initialize all the variables and flags to the starting position flag2=0; b1 = 43; / Assign Port A,C as input port and D,B as the output port. TRISA = 0xFF; TRISC = 0xFF; TRISB = 0x00; TRISD = 0x00; Initialize all the Ports PORTA=0; PORTB=0; PORTC=0; PORTD=0; Setup the A-D convertor ADCON0 = 0b ; ADCON1 = 0b ; PEIE=1; Enables interrupts for CPU GIE=1; 19

20 TMR1CS=0; T1CKPS0=0; T1CKPS1=0; Setups the timer 1 to the specs we want TMR1ON=0; Stop timer 1 TMR1H= 0xFE; Sets number of bits to count (Basically the length between interrupts) TMR1L= 0x79; TMR1ON=1; Start timer 1 TMR1IF=0; Clear interrupt flag TMR1IE=1; Enables timer 1 interrupts A/D Module not needed in this case while(1) ADGO = 1; while (ADGO) continue; Waits for A/D module reading if(adgo==0) data entry = ADRESH; 20

21 The Header File pic1687x.h Register Declarations for Microchip 16F877 Processor This header file was automatically generated by: inc2h.pl V1.5 Copyright (c) 2002, Kevin L. Pauba, All Rights Reserved SDCC is licensed under the GNU Public license (GPL) v2. Note that this license covers the code to the compiler and other executables, but explicitly does not cover any code or objects generated by sdcc. We have not yet decided on a license for the run time libraries, but it will not put any requirements on code linked against it. See: See for the latest information on sdcc. #ifndef P16F877 H #define P16F877 H #ifndef BIT AT #define BIT AT(base,bitno) sbit at ((base 3)+bitno) #endif Register addresses. #define INDF ADDR 0x0000 #define TMR0 ADDR 0x0001 #define PCL ADDR 0x0002 #define STATUS ADDR 0x0003 #define FSR ADDR 0x0004 #define PORTA ADDR 0x0005 #define PORTB ADDR 0x0006 #define PORTC ADDR 0x0007 #define PORTD ADDR 0x0008 #define PORTE ADDR 0x0009 #define PCLATH ADDR 0x000A #define INTCON ADDR 0x000B #define PIR1 ADDR 0x000C #define PIR2 ADDR 0x000D #define TMR1L ADDR 0x000E #define TMR1H ADDR 0x000F #define T1CON ADDR 0x0010 #define TMR2 ADDR 0x0011 #define T2CON ADDR 0x0012 #define SSPBUF ADDR 0x

22 #define SSPCON ADDR 0x0014 #define CCPR1L ADDR 0x0015 #define CCPR1H ADDR 0x0016 #define CCP1CON ADDR 0x0017 #define RCSTA ADDR 0x0018 #define TXREG ADDR 0x0019 #define RCREG ADDR 0x001A #define CCPR2L ADDR 0x001B #define CCPR2H ADDR 0x001C #define CCP2CON ADDR 0x001D #define ADRESH ADDR 0x001E #define ADCON0 ADDR 0x001F #define OPTION REG ADDR 0x0081 #define TRISA ADDR 0x0085 #define TRISB ADDR 0x0086 #define TRISC ADDR 0x0087 #define TRISD ADDR 0x0088 #define TRISE ADDR 0x0089 #define PIE1 ADDR 0x008C #define PIE2 ADDR 0x008D #define PCON ADDR 0x008E #define SSPCON2 ADDR 0x0091 #define PR2 ADDR 0x0092 #define SSPADD ADDR 0x0093 #define SSPSTAT ADDR 0x0094 #define TXSTA ADDR 0x0098 #define SPBRG ADDR 0x0099 #define ADRESL ADDR 0x009E #define ADCON1 ADDR 0x009F #define EEDATA ADDR 0x010C #define EEADR ADDR 0x010D #define EEDATH ADDR 0x010E #define EEADRH ADDR 0x010F #define EECON1 ADDR 0x018C #define EECON2 ADDR 0x018D Memory organization. #pragma maxram 0x1FF #pragma memmap 0x0020 0x006f RAM 0x000 #pragma memmap 0x0070 0x007f RAM 0x180 #pragma memmap 0x00a0 0x00ef RAM 0x000 #pragma memmap 0x0110 0x016f RAM 0x000 #pragma memmap 0x0190 0x01ef RAM 0x000 #pragma memmap INDF ADDR INDF ADDR SFR 0x000 INDF #pragma memmap TMR0 ADDR TMR0 ADDR SFR 0x000 TMR0 22

23 #pragma memmap PCL ADDR PCL ADDR SFR 0x000 PCL #pragma memmap STATUS ADDR STATUS ADDR SFR 0x000 STATUS #pragma memmap FSR ADDR FSR ADDR SFR 0x000 FSR #pragma memmap PORTA ADDR PORTA ADDR SFR 0x000 PORTA #pragma memmap PORTB ADDR PORTB ADDR SFR 0x000 PORTB #pragma memmap PORTC ADDR PORTC ADDR SFR 0x000 PORTC #pragma memmap PORTD ADDR PORTD ADDR SFR 0x000 PORTD #pragma memmap PORTE ADDR PORTE ADDR SFR 0x000 PORTE #pragma memmap PCLATH ADDR PCLATH ADDR SFR 0x000 PCLATH #pragma memmap INTCON ADDR INTCON ADDR SFR 0x000 INTCON #pragma memmap PIR1 ADDR PIR1 ADDR SFR 0x000 PIR1 #pragma memmap PIR2 ADDR PIR2 ADDR SFR 0x000 PIR2 #pragma memmap TMR1L ADDR TMR1L ADDR SFR 0x000 TMR1L #pragma memmap TMR1H ADDR TMR1H ADDR SFR 0x000 TMR1H #pragma memmap T1CON ADDR T1CON ADDR SFR 0x000 T1CON #pragma memmap TMR2 ADDR TMR2 ADDR SFR 0x000 TMR2 #pragma memmap T2CON ADDR T2CON ADDR SFR 0x000 T2CON #pragma memmap SSPBUF ADDR SSPBUF ADDR SFR 0x000 SSPBUF #pragma memmap SSPCON ADDR SSPCON ADDR SFR 0x000 SSPCON #pragma memmap CCPR1L ADDR CCPR1L ADDR SFR 0x000 CCPR1L #pragma memmap CCPR1H ADDR CCPR1H ADDR SFR 0x000 CCPR1H #pragma memmap CCP1CON ADDR CCP1CON ADDR SFR 0x000 CCP1CON #pragma memmap RCSTA ADDR RCSTA ADDR SFR 0x000 RCSTA #pragma memmap TXREG ADDR TXREG ADDR SFR 0x000 TXREG #pragma memmap RCREG ADDR RCREG ADDR SFR 0x000 RCREG #pragma memmap CCPR2L ADDR CCPR2L ADDR SFR 0x000 CCPR2L #pragma memmap CCPR2H ADDR CCPR2H ADDR SFR 0x000 CCPR2H #pragma memmap CCP2CON ADDR CCP2CON ADDR SFR 0x000 CCP2CON #pragma memmap ADRESH ADDR ADRESH ADDR SFR 0x000 ADRESH #pragma memmap ADCON0 ADDR ADCON0 ADDR SFR 0x000 AD- CON0 #pragma memmap OPTION REG ADDR OPTION REG ADDR SFR 0x000 OPTION REG #pragma memmap TRISA ADDR TRISA ADDR SFR 0x000 TRISA #pragma memmap TRISB ADDR TRISB ADDR SFR 0x000 TRISB #pragma memmap TRISC ADDR TRISC ADDR SFR 0x000 TRISC #pragma memmap TRISD ADDR TRISD ADDR SFR 0x000 TRISD #pragma memmap TRISE ADDR TRISE ADDR SFR 0x000 TRISE #pragma memmap PIE1 ADDR PIE1 ADDR SFR 0x000 PIE1 #pragma memmap PIE2 ADDR PIE2 ADDR SFR 0x000 PIE2 #pragma memmap PCON ADDR PCON ADDR SFR 0x000 PCON #pragma memmap SSPCON2 ADDR SSPCON2 ADDR SFR 0x000 SSP- CON2 #pragma memmap PR2 ADDR PR2 ADDR SFR 0x000 PR2 #pragma memmap SSPADD ADDR SSPADD ADDR SFR 0x000 SSPADD #pragma memmap SSPSTAT ADDR SSPSTAT ADDR SFR 0x000 SSP- STAT #pragma memmap TXSTA ADDR TXSTA ADDR SFR 0x000 TXSTA #pragma memmap SPBRG ADDR SPBRG ADDR SFR 0x000 SPBRG #pragma memmap ADRESL ADDR ADRESL ADDR SFR 0x000 ADRESL 23

24 #pragma memmap ADCON1 ADDR ADCON1 ADDR SFR 0x000 AD- CON1 #pragma memmap EEDATA ADDR EEDATA ADDR SFR 0x000 EEDATA #pragma memmap EEADR ADDR EEADR ADDR SFR 0x000 EEADR #pragma memmap EEDATH ADDR EEDATH ADDR SFR 0x000 EEDATH #pragma memmap EEADRH ADDR EEADRH ADDR SFR 0x000 EEADRH #pragma memmap EECON1 ADDR EECON1 ADDR SFR 0x000 EECON1 #pragma memmap EECON2 ADDR EECON2 ADDR SFR 0x000 EECON2 LIST P16F877.INC Standard Header File, Version 1.00 Microchip Technology, Inc. NOLIST This header file defines configurations, registers, and other useful bits of information for the PIC16F877 microcontroller. These names are taken to match the data sheets as closely as possible. Note that the processor must be selected before this file is included. The processor may be selected the following ways: 1. Command line switch: C: MPASM MYFILE.ASM /PIC16F LIST directive in the source file LIST P=PIC16F Processor Type entry in the MPASM full-screen interface ============================================= Revision History ============================================= Rev: Date: Reason: /12/00 Changed some bit names, a register name, configuration bits to match datasheet (DS30292B) /07/98 Initial Release ============================================= Verify Processor ============================================= IFNDEF 16F877 MESSG Processor-header file mismatch. Verify selected processor. 24

25 ENDIF =============================================== Register Definitions =============================================== #define W 0x0000 #define F 0x0001 Register Files data at INDF ADDR volatile char INDF; sfr at TMR0 ADDR TMR0; data at PCL ADDR volatile char PCL; sfr at STATUS ADDR STATUS; sfr at FSR ADDR FSR; sfr at PORTA ADDR PORTA; sfr at PORTB ADDR PORTB; sfr at PORTC ADDR PORTC; sfr at PORTD ADDR PORTD; sfr at PORTE ADDR PORTE; sfr at PCLATH ADDR PCLATH; sfr at INTCON ADDR INTCON; sfr at PIR1 ADDR PIR1; sfr at PIR2 ADDR PIR2; sfr at TMR1L ADDR TMR1L; sfr at TMR1H ADDR TMR1H; sfr at T1CON ADDR T1CON; sfr at TMR2 ADDR TMR2; sfr at T2CON ADDR T2CON; sfr at SSPBUF ADDR SSPBUF; sfr at SSPCON ADDR SSPCON; sfr at CCPR1L ADDR CCPR1L; sfr at CCPR1H ADDR CCPR1H; sfr at CCP1CON ADDR CCP1CON; sfr at RCSTA ADDR RCSTA; sfr at TXREG ADDR TXREG; sfr at RCREG ADDR RCREG; sfr at CCPR2L ADDR CCPR2L; sfr at CCPR2H ADDR CCPR2H; sfr at CCP2CON ADDR CCP2CON; sfr at ADRESH ADDR ADRESH; sfr at ADCON0 ADDR ADCON0; sfr at OPTION REG ADDR OPTION REG; sfr at TRISA ADDR TRISA; sfr at TRISB ADDR TRISB; sfr at TRISC ADDR TRISC; sfr at TRISD ADDR TRISD; 25

26 sfr at TRISE ADDR TRISE; sfr at PIE1 ADDR PIE1; sfr at PIE2 ADDR PIE2; sfr at PCON ADDR PCON; sfr at SSPCON2 ADDR SSPCON2; sfr at PR2 ADDR PR2; sfr at SSPADD ADDR SSPADD; sfr at SSPSTAT ADDR SSPSTAT; sfr at TXSTA ADDR TXSTA; sfr at SPBRG ADDR SPBRG; sfr at ADRESL ADDR ADRESL; sfr at ADCON1 ADDR ADCON1; sfr at EEDATA ADDR EEDATA; sfr at EEADR ADDR EEADR; sfr at EEDATH ADDR EEDATH; sfr at EEADRH ADDR EEADRH; sfr at EECON1 ADDR EECON1; sfr at EECON2 ADDR EECON2; STATUS Bits BIT AT(STATUS ADDR,7) IRP; BIT AT(STATUS ADDR,6) RP1; BIT AT(STATUS ADDR,5) RP0; BIT AT(STATUS ADDR,4) NOT TO; BIT AT(STATUS ADDR,3) NOT PD; BIT AT(STATUS ADDR,2) Z; BIT AT(STATUS ADDR,1) DC; BIT AT(STATUS ADDR,0) C; INTCON Bits BIT AT(INTCON ADDR,7) GIE; BIT AT(INTCON ADDR,6) PEIE; BIT AT(INTCON ADDR,5) T0IE; BIT AT(INTCON ADDR,4) INTE; BIT AT(INTCON ADDR,3) RBIE; BIT AT(INTCON ADDR,2) T0IF; BIT AT(INTCON ADDR,1) INTF; BIT AT(INTCON ADDR,0) RBIF; PIR1 Bits BIT AT(PIR1 ADDR,7) PSPIF; BIT AT(PIR1 ADDR,6) ADIF; BIT AT(PIR1 ADDR,5) RCIF; BIT AT(PIR1 ADDR,4) TXIF; BIT AT(PIR1 ADDR,3) SSPIF; 26

27 BIT AT(PIR1 ADDR,2) CCP1IF; BIT AT(PIR1 ADDR,1) TMR2IF; BIT AT(PIR1 ADDR,0) TMR1IF; PIR2 Bits BIT AT(PIR2 ADDR,4) EEIF; BIT AT(PIR2 ADDR,3) BCLIF; BIT AT(PIR2 ADDR,0) CCP2IF; T1CON Bits BIT AT(T1CON ADDR,5) T1CKPS1; BIT AT(T1CON ADDR,4) T1CKPS0; BIT AT(T1CON ADDR,3) T1OSCEN; BIT AT(T1CON ADDR,2) NOT T1SYNC; BIT AT(T1CON ADDR,2) T1INSYNC; Backward compatibility only BIT AT(T1CON ADDR,2) T1SYNC; BIT AT(T1CON ADDR,1) TMR1CS; BIT AT(T1CON ADDR,0) TMR1ON; T2CON Bits BIT AT(T2CON ADDR,6) TOUTPS3; BIT AT(T2CON ADDR,5) TOUTPS2; BIT AT(T2CON ADDR,4) TOUTPS1; BIT AT(T2CON ADDR,3) TOUTPS0; BIT AT(T2CON ADDR,2) TMR2ON; BIT AT(T2CON ADDR,1) T2CKPS1; BIT AT(T2CON ADDR,0) T2CKPS0; SSPCON Bits BIT AT(SSPCON ADDR,7) WCOL; BIT AT(SSPCON ADDR,6) SSPOV; BIT AT(SSPCON ADDR,5) SSPEN; BIT AT(SSPCON ADDR,4) CKP; BIT AT(SSPCON ADDR,3) SSPM3; BIT AT(SSPCON ADDR,2) SSPM2; BIT AT(SSPCON ADDR,1) SSPM1; BIT AT(SSPCON ADDR,0) SSPM0; CCP1CON Bits BIT AT(CCP1CON ADDR,5) CCP1X; BIT AT(CCP1CON ADDR,4) CCP1Y; BIT AT(CCP1CON ADDR,3) CCP1M3; BIT AT(CCP1CON ADDR,2) CCP1M2; BIT AT(CCP1CON ADDR,1) CCP1M1; BIT AT(CCP1CON ADDR,0) CCP1M0; 27

28 RCSTA Bits - BIT AT(RCSTA ADDR,7) SPEN; BIT AT(RCSTA ADDR,6) RX9; BIT AT(RCSTA ADDR,6) RC9; Backward compatibility only BIT AT(RCSTA ADDR,6) NOT RC8; Backward compatibility only BIT AT(RCSTA ADDR,6) RC8 9; Backward compatibility only BIT AT(RCSTA ADDR,5) SREN; BIT AT(RCSTA ADDR,4) CREN; BIT AT(RCSTA ADDR,3) ADDEN; BIT AT(RCSTA ADDR,2) FERR; BIT AT(RCSTA ADDR,1) OERR; BIT AT(RCSTA ADDR,0) RX9D; BIT AT(RCSTA ADDR,0) RCD8; Backward compatibility only CCP2CON Bits BIT AT(CCP2CON ADDR,5) CCP2X; BIT AT(CCP2CON ADDR,4) CCP2Y; BIT AT(CCP2CON ADDR,3) CCP2M3; BIT AT(CCP2CON ADDR,2) CCP2M2; BIT AT(CCP2CON ADDR,1) CCP2M1; BIT AT(CCP2CON ADDR,0) CCP2M0; ADCON0 Bits BIT AT(ADCON0 ADDR,7) ADCS1; BIT AT(ADCON0 ADDR,6) ADCS0; BIT AT(ADCON0 ADDR,5) CHS2; BIT AT(ADCON0 ADDR,4) CHS1; BIT AT(ADCON0 ADDR,3) CHS0; BIT AT(ADCON0 ADDR,2) GO; BIT AT(ADCON0 ADDR,2) NOT DONE; BIT AT(ADCON0 ADDR,2) GO DONE; BIT AT(ADCON0 ADDR,0) ADON; OPTION REG Bits BIT AT(OPTION REG ADDR,7) NOT RBPU; BIT AT(OPTION REG ADDR,6) INTEDG; BIT AT(OPTION REG ADDR,5) T0CS; BIT AT(OPTION REG ADDR,4) T0SE; BIT AT(OPTION REG ADDR,3) PSA; BIT AT(OPTION REG ADDR,2) PS2; BIT AT(OPTION REG ADDR,1) PS1; BIT AT(OPTION REG ADDR,0) PS0; TRISE Bits 28

29 BIT AT(TRISE ADDR,7) IBF; BIT AT(TRISE ADDR,6) OBF; BIT AT(TRISE ADDR,5) IBOV; BIT AT(TRISE ADDR,4) PSPMODE; BIT AT(TRISE ADDR,2) TRISE2; BIT AT(TRISE ADDR,1) TRISE1; BIT AT(TRISE ADDR,0) TRISE0; PIE1 Bits BIT AT(PIE1 ADDR,7) PSPIE; BIT AT(PIE1 ADDR,6) ADIE; BIT AT(PIE1 ADDR,5) RCIE; BIT AT(PIE1 ADDR,4) TXIE; BIT AT(PIE1 ADDR,3) SSPIE; BIT AT(PIE1 ADDR,2) CCP1IE; BIT AT(PIE1 ADDR,1) TMR2IE; BIT AT(PIE1 ADDR,0) TMR1IE; PIE2 Bits BIT AT(PIE2 ADDR,4) EEIE; BIT AT(PIE2 ADDR,3) BCLIE; BIT AT(PIE2 ADDR,0) CCP2IE; PCON Bits BIT AT(PCON ADDR,1) NOT POR; BIT AT(PCON ADDR,0) NOT BO; BIT AT(PCON ADDR,0) NOT BOR; SSPCON2 Bits BIT AT(SSPCON2 ADDR,7) GCEN; BIT AT(SSPCON2 ADDR,6) ACKSTAT; BIT AT(SSPCON2 ADDR,5) ACKDT; BIT AT(SSPCON2 ADDR,4) ACKEN; BIT AT(SSPCON2 ADDR,3) RCEN; BIT AT(SSPCON2 ADDR,2) PEN; BIT AT(SSPCON2 ADDR,1) RSEN; BIT AT(SSPCON2 ADDR,0) SEN; SSPSTAT Bits - BIT AT(SSPSTAT ADDR,7) SMP; BIT AT(SSPSTAT ADDR,6) CKE; BIT AT(SSPSTAT ADDR,5) D; BIT AT(SSPSTAT ADDR,5) I2C DATA; BIT AT(SSPSTAT ADDR,5) NOT A; BIT AT(SSPSTAT ADDR,5) NOT ADDRESS; 29

30 BIT AT(SSPSTAT ADDR,5) D A; BIT AT(SSPSTAT ADDR,5) DATA ADDRESS; BIT AT(SSPSTAT ADDR,4) P; BIT AT(SSPSTAT ADDR,4) I2C STOP; BIT AT(SSPSTAT ADDR,3) S; BIT AT(SSPSTAT ADDR,3) I2C START; BIT AT(SSPSTAT ADDR,2) R; BIT AT(SSPSTAT ADDR,2) I2C READ; BIT AT(SSPSTAT ADDR,2) NOT W; BIT AT(SSPSTAT ADDR,2) NOT WRITE; BIT AT(SSPSTAT ADDR,2) R W; BIT AT(SSPSTAT ADDR,2) READ WRITE; BIT AT(SSPSTAT ADDR,1) UA; BIT AT(SSPSTAT ADDR,0) BF; TXSTA Bits - BIT AT(TXSTA ADDR,7) CSRC; BIT AT(TXSTA ADDR,6) TX9; BIT AT(TXSTA ADDR,6) NOT TX8; Backward compatibility only BIT AT(TXSTA ADDR,6) TX8 9; Backward compatibility only BIT AT(TXSTA ADDR,5) TXEN; BIT AT(TXSTA ADDR,4) SYNC; BIT AT(TXSTA ADDR,2) BRGH; BIT AT(TXSTA ADDR,1) TRMT; BIT AT(TXSTA ADDR,0) TX9D; BIT AT(TXSTA ADDR,0) TXD8; Backward compatibility only ADCON1 Bits BIT AT(ADCON1 ADDR,7) ADFM; BIT AT(ADCON1 ADDR,3) PCFG3; BIT AT(ADCON1 ADDR,2) PCFG2; BIT AT(ADCON1 ADDR,1) PCFG1; BIT AT(ADCON1 ADDR,0) PCFG0; EECON1 Bits BIT AT(EECON1 ADDR,7) EEPGD; BIT AT(EECON1 ADDR,3) WRERR; BIT AT(EECON1 ADDR,2) WREN; BIT AT(EECON1 ADDR,1) WR; BIT AT(EECON1 ADDR,0) RD; =========================================== RAM Definition =========================================== 30

31 MAXRAM H 1FF BADRAM H 8F -H 90, H 95 -H 97, H 9A -H 9D BADRAM H 105, H 107 -H 109 BADRAM H 185, H 187 -H 189, H 18E -H 18F =========================================== Configuration Bits =========================================== #define CP ALL 0x0FCF #define CP HALF 0x1FDF #define CP UPPER 256 0x2FEF #define CP OFF 0x3FFF #define DEBUG ON 0x37FF #define DEBUG OFF 0x3FFF #define WRT ENABLE ON 0x3FFF #define WRT ENABLE OFF 0x3DFF #define CPD ON 0x3EFF #define CPD OFF 0x3FFF #define LVP ON 0x3FFF #define LVP OFF 0x3F7F #define BODEN ON 0x3FFF #define BODEN OFF 0x3FBF #define PWRTE OFF 0x3FFF #define PWRTE ON 0x3FF7 #define WDT ON 0x3FFF #define WDT OFF 0x3FFB #define LP OSC 0x3FFC #define XT OSC 0x3FFD #define HS OSC 0x3FFE #define RC OSC 0x3FFF LIST #endif 31

Chapter 13. PIC Family Microcontroller

Chapter 13. PIC Family Microcontroller Chapter 13 PIC Family Microcontroller Lesson 06 Special Function Registers for Control and status registers for the peripherals, input/output and Interrupt SFRs SFRs at the addresses of internal RAM/register

More information

Example of Asyncronous Serial Comms on a PIC16F877

Example of Asyncronous Serial Comms on a PIC16F877 /***************************************************************************************/ /* Example of Asyncronous Serial Comms on a PIC16F877 */ /* Target: PIC16F877 */ /* Baud: 9600 */ /* Bits: 8 */

More information

PIC16F87X. 28/40-pin 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram PDIP. Microcontroller Core Features:

PIC16F87X. 28/40-pin 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram PDIP. Microcontroller Core Features: 28/40-pin 8-Bit CMOS FLASH Microcontrollers Devices Included in this Data Sheet: PIC16F873 PIC16F874 PIC16F876 PIC16F877 Microcontroller Core Features: High-performance RISC CPU Only 35 single word instructions

More information

PIC16F870/ /40-Pin, 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram. Microcontroller Core Features:

PIC16F870/ /40-Pin, 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram. Microcontroller Core Features: 28/40-Pin, 8-Bit CMOS FLASH Microcontrollers Devices Included in this Data Sheet: Pin Diagram PIC16F870 PIC16F871 PDIP Microcontroller Core Features: High performance RISC CPU Only 35 single word instructions

More information

PIC16F87XA Data Sheet

PIC16F87XA Data Sheet M Data Sheet 28/40-pin Enhanced FLASH Microcontrollers 2001 Microchip Technology Inc. Advance Information DS39582A 2001 Microchip Technology Inc. Advance Information DS39582A-page 3 Pin Diagram RB7/PGD

More information

PIC18FXX2 Registers. Hyperlinked Index

PIC18FXX2 Registers. Hyperlinked Index PIC18FXX2 Registers This document provides a concise summary of the names and bit definitions for the PIC18FXX2 Special Function Registers, Configuration Registers and Device ID Registers. Hyperlinked

More information

Outlines. PIC Programming in C and Assembly. Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University

Outlines. PIC Programming in C and Assembly. Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University PIC ming in C and Assembly Outlines Microprocessor vs. MicroController PIC in depth PIC ming Assembly ming Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University Embedded C

More information

PIC16F /40-Pin 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram PDIP. Microcontroller Core Features:

PIC16F /40-Pin 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram PDIP. Microcontroller Core Features: 28/40-Pin 8-Bit CMOS FLASH Microcontrollers Devices Included in this Data Sheet: PIC16F870 PIC16F871 Microcontroller Core Features: High-performance RISC CPU Only 35 single word instructions to learn All

More information

PIC16F818/819 Data Sheet

PIC16F818/819 Data Sheet Data Sheet 18/20-Pin Enhanced FLASH Microcontrollers with nanowatt Technology 2002 Microchip Technology Inc. Preliminary DS39598C Note the following details of the code protection feature on Microchip

More information

PIC16F872 Data Sheet. 28-Pin, 8-Bit CMOS Flash Microcontroller with 10-Bit A/D Microchip Technology Inc. DS30221C

PIC16F872 Data Sheet. 28-Pin, 8-Bit CMOS Flash Microcontroller with 10-Bit A/D Microchip Technology Inc. DS30221C Data Sheet 28-Pin, 8-Bit CMOS Flash Microcontroller with 10-Bit A/D 2006 Microchip Technology Inc. DS30221C Note the following details of the code protection feature on Microchip devices: Microchip products

More information

Contents. PIC Mini Data Sheets

Contents. PIC Mini Data Sheets Contents PIC16C5x... 5 PIC16C5x Pin-Outs... 5 PIC16C5x Microcontrollers... 6 Peripheral Features... 6 Internal Architecture... 9 PIC16C5x Registers... 9 PIC16C64... 18 PIC16C64 Pin-Out...18 New and Modified

More information

Speed Control of a DC Motor using Digital Control

Speed Control of a DC Motor using Digital Control Speed Control of a DC Motor using Digital Control The scope of this project is threefold. The first part of the project is to control an LCD display and use it as part of a digital tachometer. Secondly,

More information

PIC16F7X Data Sheet. 28/40-pin, 8-bit CMOS FLASH Microcontrollers Microchip Technology Inc. DS30325B

PIC16F7X Data Sheet. 28/40-pin, 8-bit CMOS FLASH Microcontrollers Microchip Technology Inc. DS30325B M PIC16F7X Data Sheet 28/40-pin, 8-bit CMOS FLASH Microcontrollers 2002 Microchip Technology Inc. DS30325B Note the following details of the code protection feature on PICmicro MCUs. The PICmicro family

More information

Embedded Systems Programming and Architectures

Embedded Systems Programming and Architectures Embedded Systems Programming and Architectures Lecture No 10 : Data acquisition and data transfer Dr John Kalomiros Assis. Professor Department of Post Graduate studies in Communications and Informatics

More information

PIC16C7X 11.0 SYNCHRONOUS SERIAL PORT (SSP) MODULE SSP Module Overview. Applicable Devices

PIC16C7X 11.0 SYNCHRONOUS SERIAL PORT (SSP) MODULE SSP Module Overview. Applicable Devices Applicable Devices PIC16C7X 11.0 SYNCHRONOUS SERIAL PORT (SSP) MODULE 11.1 SSP Module Overview The Synchronous Serial Port (SSP) module is a serial interface useful for communicating with other peripheral

More information

Distributed by: www.jameco.com 1-800-831-4242 The content and copyrights of the attached material are the property of its owner. M PIC16F87XA Data Sheet 28/40-pin Enhanced FLASH Microcontrollers 2001 Microchip

More information

Sales: Technical: Fax:

Sales: Technical: Fax: DATA SHEET PIC Microcontrollers Order code Manufacturer code Description 73-3352 n/a PIC16F877A-I/P (RC) PIC Microcontrollers The enclosed information is believed to be correct, Information may change

More information

Acronyms and Abbreviations

Acronyms and Abbreviations Appendix A Acronyms and Abbreviations ADC (A/D) Analog-to-Digital Converter/Conversion ADCON0 A/D CONtrol 0 ADCON1 ADC CONtrol 1 ADCSn ADC Clock Select, bits; ADCON0[7:6] ADDEN ADDress ENable; RCSTA[3]

More information

Chapter 10 Sections 1,2,9,10 Dr. Iyad Jafar

Chapter 10 Sections 1,2,9,10 Dr. Iyad Jafar Starting with Serial Chapter 10 Sections 1,2,9,10 Dr. Iyad Jafar Outline Introduction Synchronous Serial Communication Asynchronous Serial Communication Physical Limitations Overview of PIC 16 Series The

More information

Embedded System Design

Embedded System Design ĐẠI HỌC QUỐC GIA TP.HỒ CHÍ MINH TRƯỜNG ĐẠI HỌC BÁCH KHOA KHOA ĐIỆN-ĐIỆN TỬ BỘ MÔN KỸ THUẬT ĐIỆN TỬ Embedded System Design : Microcontroller 1. Introduction to PIC microcontroller 2. PIC16F84 3. PIC16F877

More information

Timer0..Timer3. Interrupt Description Input Conditions Enable Flag

Timer0..Timer3. Interrupt Description Input Conditions Enable Flag Timer0..Timer3 Timers are pretty useful: likewise, Microchip provides four different timers for you to use. Like all interrupts, you have to Enable the interrupt, Set the conditions of the interrupt, and

More information

Mid-Range Family Peripheral Configuration with C Programming

Mid-Range Family Peripheral Configuration with C Programming Mid-Range Family Peripheral Configuration with C Programming MCU 2 26 Microchip Technology Incorporated. All Rights Reserved. 2ASP Rev. January Slide 28 Objectives At the end of this class you will: Understand

More information

Section 21. Addressable USART

Section 21. Addressable USART 21 Section 21. Addressable USART Addressable USART HIGHLIGHTS This section of the manual contains the following major topics: 21.1 Introduction... 21-2 21.2 Control Registers... 21-3 21.3 USART Baud Rate

More information

PIC16F87/88 Data Sheet

PIC16F87/88 Data Sheet Data Sheet 18/20/28-Pin Enhanced Flash Microcontrollers with nanowatt Technology 2005 Microchip Technology Inc. DS30487C Note the following details of the code protection feature on Microchip devices:

More information

ELCT 912: Advanced Embedded Systems

ELCT 912: Advanced Embedded Systems ELCT 912: Advanced Embedded Systems Lecture 10: Applications for Programming PIC18 in C Dr. Mohamed Abd El Ghany, Department of Electronics and Electrical Engineering Programming the PIC18 to transfer

More information

Embedded Systems Design (630470) Lecture 4. Memory Organization. Prof. Kasim M. Al-Aubidy Computer Eng. Dept.

Embedded Systems Design (630470) Lecture 4. Memory Organization. Prof. Kasim M. Al-Aubidy Computer Eng. Dept. Embedded Systems Design (630470) Lecture 4 Memory Organization Prof. Kasim M. Al-Aubidy Computer Eng. Dept. Memory Organization: PIC16F84 has two separate memory blocks, for data and for program. EEPROM

More information

Timer1 Capture Mode:

Timer1 Capture Mode: Timer1 Capture Mode: Interrupt Description Input Conditions Enable Flag Timer 1 Trigger after N events N = 1.. 2 19 100ns to 0.52 sec RC0 TMR1CS = 1 TMR1IF Timer 1 Capture Mode 1 Timer 1 Capture Mode 2

More information

PIC16C745/ Bit CMOS Microcontrollers with USB. Pin Diagrams. Devices included in this data sheet: Microcontroller Core Features:

PIC16C745/ Bit CMOS Microcontrollers with USB. Pin Diagrams. Devices included in this data sheet: Microcontroller Core Features: 8-Bit CMOS Microcontrollers with USB Devices included in this data sheet: PIC16C745 PIC16C765 Microcontroller Core Features: High-performance RISC CPU Only 35 single word instructions Device Memory Program

More information

Section 16. Basic Sychronous Serial Port (BSSP)

Section 16. Basic Sychronous Serial Port (BSSP) M 16 Section 16. Basic Sychronous Serial Port (BSSP) BSSP HIGHLIGHTS This section of the manual contains the following major topics: 16.1 Introduction...16-2 16.2 Control Registers...16-3 16.3 SPI Mode...16-6

More information

V23026 series Miniature, Sealed PC Board Relay

V23026 series Miniature, Sealed PC Board Relay Through-Hole or Surface Mount Features Surface and through-hole mounting types. 1 Form C contact arrangement. Latching or non-latching versions available. Switches loads from dry circuit to 1 amp. Washable

More information

Serial Communication

Serial Communication Serial Communication What is serial communication? Basic Serial port operation. Classification of serial communication. (UART,SPI,I2C) Serial port module in PIC16F887 IR Remote Controller Prepared By-

More information

More Fun with Timer Interrupts

More Fun with Timer Interrupts More Fun with Timer Interrupts Chords Objective: Play a musical chord each time you press a button: Button RC0 RC1 RC2 Timer Timer0 Timer1 Timer3 RB0 A3 C4 E4 RB1 B3 D4 F4 RB2 C4 E4 G4 Calculations: Assume

More information

EET203 MICROCONTROLLER SYSTEMS DESIGN Serial Port Interfacing

EET203 MICROCONTROLLER SYSTEMS DESIGN Serial Port Interfacing EET203 MICROCONTROLLER SYSTEMS DESIGN Serial Port Interfacing Objectives Explain serial communication protocol Describe data transfer rate and bps rate Describe the main registers used by serial communication

More information

EE6008-Microcontroller Based System Design Department Of EEE/ DCE

EE6008-Microcontroller Based System Design Department Of EEE/ DCE UNIT- II INTERRUPTS AND TIMERS PART A 1. What are the interrupts available in PIC? (Jan 14) Interrupt Source Enabled by Completion Status External interrupt from INT INTE = 1 INTF = 1 TMR0 interrupt T0IE

More information

TB033. Using the PIC16F877 To Develop Code For PIC16CXXX Devices INTRODUCTION. Stan D Souza, Rodger Richey Microchip Technology Inc.

TB033. Using the PIC16F877 To Develop Code For PIC16CXXX Devices INTRODUCTION. Stan D Souza, Rodger Richey Microchip Technology Inc. Using the PIC16F877 To Develop Code For PIC16CXXX Devices TB033 Authors: INTRODUCTION Stan D Souza, Rodger Richey Microchip Technology Inc. With the release of the FLASH-based PIC16F87X family, Microchip

More information

Kit Contents. Getting Started Kits. Board. Board

Kit Contents. Getting Started Kits. Board. Board Kit Contents Getting Started Kits Each kit has the following items: Board with microcontroller (18(L)F4620) Power brick for the board. Programmer, and power brick for programmer. USB logic analyzer Digital

More information

Experiment 7:The USART

Experiment 7:The USART University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory 0907334 7 Experiment 7:The USART Objectives Introduce the USART module of the PIC

More information

Lecture (04) PIC16F84A (3)

Lecture (04) PIC16F84A (3) Lecture (04) PIC16F84A (3) By: Dr. Ahmed ElShafee ١ Central Processing Unit Central processing unit (CPU) is the brain of a microcontroller responsible for finding and fetching the right instruction which

More information

PIC Microcontroller Embedded Systems Hadassah College Spring 2012 PIC Microcontroller Dr. Martin Land

PIC Microcontroller Embedded Systems Hadassah College Spring 2012 PIC Microcontroller Dr. Martin Land PIC Microcontroller 1 (MCU) Widely used device from Microchip Technology Sold > 10 billion PIC controllers Several device families Many devices per family Common development environment Widely available

More information

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan PIC18 Serial Port Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan chanhl@mail.cgu.edu.twcgu Serial vs. parallel data transfer 2 Simplex, half-, and full-duplex transfers 3

More information

PIC 16F84A programming (II)

PIC 16F84A programming (II) Lecture (05) PIC 16F84A programming (II) Dr. Ahmed M. ElShafee ١ Introduction to 16F84 ٣ PIC16F84 belongs to a class of 8-bit microcontrollers of RISC architecture. Program memory (FLASH) EEPROM RAM PORTA

More information

EEE111A/B Microprocessors

EEE111A/B Microprocessors EEE111A/B Microprocessors Revision Notes Lecture 1: What s it all About? Covers the basic principles of digital signals. The intelligence of virtually all communications, control and electronic devices

More information

Super Awesome Multitasking Microcontroller Interface for Electromechanical Systems (S.A.M.M.I.E.S.) Pinball Table

Super Awesome Multitasking Microcontroller Interface for Electromechanical Systems (S.A.M.M.I.E.S.) Pinball Table Super Awesome Multitasking Microcontroller Interface for Electromechanical Systems (S.A.M.M.I.E.S.) Pinball Table Group 13 April 29 th, 2008 Faculty Advisor: Professor Haibo He Group Members: William McGuire

More information

Section 14. Timer1 HIGHLIGHTS. Timer1. This section of the manual contains the following major topics:

Section 14. Timer1 HIGHLIGHTS. Timer1. This section of the manual contains the following major topics: Section 14. Timer1 HIGHLIGHTS This section of the manual contains the following major topics: 14.1 Introduction... 14-2 14.2 Control Register... 14-4 14.3 Timer1 Operation in Timer Mode... 14-5 14.4 Timer1

More information

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 RESIT. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J1. Time allowed: 3 Hours

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 RESIT. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J1. Time allowed: 3 Hours UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 RESIT Year 2 MICROCONTROLLER SYSTEMS Module Code: EEE305J1 Time allowed: 3 Hours Answer as many questions as you can. Not more than TWO questions

More information

NH-67, TRICHY MAIN ROAD, PULIYUR, C.F , KARUR DT. DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING COURSE MATERIAL

NH-67, TRICHY MAIN ROAD, PULIYUR, C.F , KARUR DT. DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING COURSE MATERIAL NH-67, TRICHY MAIN ROAD, PULIYUR, C.F. 639 114, KARUR DT. DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING COURSE MATERIAL Subject Name : Embedded System Class/Sem : BE (ECE) / VII Subject Code

More information

Timer2 Interrupts. NDSU Timer2 Interrupts September 20, Background:

Timer2 Interrupts. NDSU Timer2 Interrupts September 20, Background: Background: Timer2 Interrupts The execution time for routines sometimes needs to be set. This chapter loops at several ways to set the sampling rate. Example: Write a routine which increments an 8-bit

More information

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002. Semester 2. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J2. Time allowed: 3 Hours

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002. Semester 2. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J2. Time allowed: 3 Hours UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 Semester 2 Year 2 MICROCONTROLLER SYSTEMS Module Code: EEE305J2 Time allowed: 3 Hours Answer as many questions as you can. Not more than TWO questions

More information

Serial Communication with PIC16F877A

Serial Communication with PIC16F877A Serial Communication with PIC16F877A In this tutorial we are going to discuss the serial/uart communication using PIC16F877A. PIC16F877A comes with inbuilt USART which can be used for Synchronous/Asynchronous

More information

M PIC16F84A. 18-pinEnhanced FLASH/EEPROM 8-Bit Microcontroller. High Performance RISC CPU Features: Pin Diagrams. Peripheral Features:

M PIC16F84A. 18-pinEnhanced FLASH/EEPROM 8-Bit Microcontroller. High Performance RISC CPU Features: Pin Diagrams. Peripheral Features: M PIC6F84A 8-pinEnhanced FLASH/EEPROM 8-Bit Microcontroller High Performance RISC CPU Features: Pin Diagrams Only 35 single word instructions to learn All instructions single-cycle except for program branches

More information

ELE492 Embedded System Design

ELE492 Embedded System Design Overview ELE9 Embedded System Design Examples of Human I/O Interfaces Types of System Interfaces Use of standards RS Serial Communication Overview of SPI, I C, L, and CAN Class //0 Eugene Chabot Examples

More information

PIC16F630/676 Data Sheet

PIC16F630/676 Data Sheet M PIC16F630/676 Data Sheet 14-Pin FLASH-Based 8-Bit CMOS Microcontrollers 2002 Microchip Technology Inc. Preliminary DS4003A Note the following details of the code protection feature on PICmicro MCUs.

More information

ECE Homework #10

ECE Homework #10 Timer 0/1/2/3 ECE 376 - Homework #10 Timer 0/1/2/3, INT Interrupts. Due Wednesday, November 14th, 2018 1) Write a program which uses INT and Timer 0/1/2/3 interrupts to play the cord C#major for 1.000

More information

Hardware Interfacing. EE25M Introduction to microprocessors. Part V. 15 Interfacing methods. original author: Feisal Mohammed

Hardware Interfacing. EE25M Introduction to microprocessors. Part V. 15 Interfacing methods. original author: Feisal Mohammed EE25M Introduction to microprocessors original author: Feisal Mohammed updated: 18th February 2002 CLR Part V Hardware Interfacing There are several features of computers/microcontrollers which have not

More information

ELCT706 MicroLab Session #4 UART Usage for Bluetooth connection PC - PIC

ELCT706 MicroLab Session #4 UART Usage for Bluetooth connection PC - PIC ELCT706 MicroLab Session #4 UART Usage for Bluetooth connection PC - PIC USART in PIC16F877A Universal Synchronous/Asynchronous Receiver Transmitter - Can receive and transmit - Can be synchronous or Asynchronous

More information

ME 6405 Introduction to Mechatronics

ME 6405 Introduction to Mechatronics ME 6405 Introduction to Mechatronics Fall 2006 Instructor: Professor Charles Ume Microchip PIC Manufacturer Information: Company: Website: http://www.microchip.com Reasons for success: Became the hobbyist's

More information

University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory

University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory 0907334 6 Experiment 6:Timers Objectives To become familiar with hardware timing

More information

ELCT706 MicroLab Session #4 UART Usage for Bluetooth connection PC - PIC

ELCT706 MicroLab Session #4 UART Usage for Bluetooth connection PC - PIC ELCT706 MicroLab Session #4 UART Usage for Bluetooth connection PC - PIC USART in PIC16F877A Universal Synchronous/Asynchronous Receiver Transmitter - Can receive and transmit - Can be synchronous or Asynchronous

More information

/*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */

/*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */ /*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */ /*the speed the cell which are less dense can float and the cell that are denser can sink*/ /*the user has five

More information

Section 13. Timer0 HIGHLIGHTS. Timer0. This section of the manual contains the following major topics:

Section 13. Timer0 HIGHLIGHTS. Timer0. This section of the manual contains the following major topics: Section 13. Timer0 HIGHLIGHTS This section of the manual contains the following major topics: 13.1 Introduction... 13-2 13.2 Control Register... 13-3 13.3 Operation... 13-4 13.4 Timer0 Interrupt... 13-5

More information

Hong Kong Institute of Vocational Education Digital Electronics & Microcontroller. 8. Microcontroller

Hong Kong Institute of Vocational Education Digital Electronics & Microcontroller. 8. Microcontroller 8. Microcontroller Textbook Programming Robot Controllers, Myke Predko, McGraw Hill. Reference PIC Robotics: A Beginner's Guide to Robotics Projects Using the PIC Micro, John Iovine, McGraw Hill. Embedded

More information

Embedded systems. Exercise session 3. Microcontroller Programming Lab Preparation

Embedded systems. Exercise session 3. Microcontroller Programming Lab Preparation Embedded systems Exercise session 3 Microcontroller Programming Lab Preparation Communications Contact Mail : michael.fonder@ulg.ac.be Office : 1.82a, Montefiore Website for the exercise sessions and the

More information

SRF08 Ultra sonic range finder

SRF08 Ultra sonic range finder SRF08 Ultra sonic range finder Technical Specification Communication with the SRF08 ultrasonic rangefinder is via the I2C bus. This is available on popular controllers such as the OOPic and Stamp BS2p,

More information

Dept. of Computer Engineering Final Exam, First Semester: 2016/2017

Dept. of Computer Engineering Final Exam, First Semester: 2016/2017 Philadelphia University Faculty of Engineering Course Title: Embedded Systems (630414) Instructor: Eng. Anis Nazer Dept. of Computer Engineering Final Exam, First Semester: 2016/2017 Student Name: Student

More information

Team 8: Robert Blake Craig Goliber Alanna Ocampo

Team 8: Robert Blake Craig Goliber Alanna Ocampo Team 8: Robert Blake Craig Goliber Alanna Ocampo Objective of the design CAD Presentation Microcontroller Implementation PCB Design Design Limitations Conclusion Problem: Design a centrifuge which was

More information

Embedded Systems Module. 6EJ505. C Tutorial 3: using the ICD3 rev tjw

Embedded Systems Module. 6EJ505. C Tutorial 3: using the ICD3 rev tjw Embedded Systems Module. 6EJ505 C Tutorial 3: using the ICD3 rev. 27.9.16 tjw Images are reproduced from Reference 1. Microchip permits the use of its images for educational purposes. Main Learning Points

More information

BME 4900 Page 1 of 2. Meeting 2: Personal Progress Report 12/2/09 Team 12 with Drew Seils. Semester One Week Two

BME 4900 Page 1 of 2. Meeting 2: Personal Progress Report 12/2/09 Team 12 with Drew Seils. Semester One Week Two BME 4900 Page 1 of 2 Semester One Week Two These past two saw a lot of progress with the Revo stationary bike project. During Thanksgiving break Shane spent most of his time doing research for the power

More information

Flow Charts and Assembler Programs

Flow Charts and Assembler Programs Flow Charts and Assembler Programs Flow Charts: A flow chart is a graphical way to display how a program works (i.e. the algorithm). The purpose of a flow chart is to make the program easier to understand.

More information

PIC16F84A. 18-pin Enhanced Flash/EEPROM 8-Bit Microcontroller. Devices Included in this Data Sheet: Pin Diagrams. High Performance RISC CPU Features:

PIC16F84A. 18-pin Enhanced Flash/EEPROM 8-Bit Microcontroller. Devices Included in this Data Sheet: Pin Diagrams. High Performance RISC CPU Features: M PIC6F84A 8-pin Enhanced Flash/EEPROM 8-Bit Microcontroller Devices Included in this Data Sheet: PIC6F84A Extended voltage range device available (PIC6LF84A) High Performance RISC CPU Features: Only 35

More information

M Low-Power Real-Time Clock

M Low-Power Real-Time Clock M Low-Power Real-Time Clock Author: INTRODUCTION This application note uses the Timer1 module, from a mid-range PIC16CXXX microcontroller, to control a low-power real-time clock. Timer1 was chosen because

More information

Embedded Systems Lab Lab 8 EEPROM

Embedded Systems Lab Lab 8 EEPROM Islamic University of Gaza College of Engineering Computer Department Embedded Systems Lab EEPROM Prepared By: Eng.Ola M. Abd El-Latif Apr. /2010 :D 0 Objectives To get familiar with using the EEPROM of

More information

PIC12F629/675 Data Sheet

PIC12F629/675 Data Sheet M PIC12F62/675 Data Sheet 8-Pin FLASH-Based 8-Bit CMOS Microcontrollers 2002 Microchip Technology Inc. Preliminary DS4110A Note the following details of the code protection feature on PICmicro MCUs. The

More information

Learning Objectives:

Learning Objectives: Topic 5.2.1 PIC microcontrollers Learning Objectives: At the end of this topic you will be able to; Recall the architecture of a PIC microcontroller, consisting of CPU, clock, data memory, program memory

More information

Interrupts on PIC18F252 Part 2

Interrupts on PIC18F252 Part 2 Interrupts on PIC18F252 Part 2 Following pages list Special Function Registers (SFRs) involved in interrupt configuration and operation on PIC18F252 microcontroller. (Copied from Microchip s PIC18Fxx2

More information

Appendix A Acronyms and Abbreviations

Appendix A Acronyms and Abbreviations Appendix A Acronyms and Abbreviations ABDEN Automatic BauD rate ENable; BAUDCON[0] ABDOVF Automatic BauD rate OVerFlow; BAUDCON[7] ACK ACKnowledge state in the I 2 Cprotocol ACQT2:0 ACQuition Time delay

More information

Interrupts on PIC18F252 Part 2. Interrupts Programming in C Language

Interrupts on PIC18F252 Part 2. Interrupts Programming in C Language Interrupts on PIC18F252 Part 2 Interrupts Programming in C Language Programming interrupts in C language using XC8 compiler is significantly simplified compared to C18 compiler. This note explains the

More information

PIC16F630/676 Data Sheet

PIC16F630/676 Data Sheet Data Sheet 14-Pin, Flash-Based 8-Bit CMOS Microcontrollers 2007 Microchip Technology Inc. DS40039E Note the following details of the code protection feature on Microchip devices: Microchip products meet

More information

which means that writing to a port implies that the port pins are first read, then this value is modified and then written to the port data latch.

which means that writing to a port implies that the port pins are first read, then this value is modified and then written to the port data latch. Introduction to microprocessors Feisal Mohammed 3rd January 2001 Additional features 1 Input/Output Ports One of the features that differentiates a microcontroller from a microprocessor is the presence

More information

Using the 8-Bit Parallel Slave Port

Using the 8-Bit Parallel Slave Port M AN579 Using the 8-Bit Parallel Slave Port Author: INTRODUCTION PIC16C64/74 microcontrollers from Microchip Technology Inc. can be interfaced with ease into a multi-microprocessor environment using its

More information

Using Timers of Microchip PIC18F Microcontrollers

Using Timers of Microchip PIC18F Microcontrollers Using Timers of Microchip PIC18F Microcontrollers ARSLAB - Autonomous and Robotic Systems Laboratory Dipartimento di Matematica e Informatica - Università di Catania, Italy santoro@dmi.unict.it L.A.P.

More information

University of Dayton. Electrical & Computer Engineering. ECE 536 Microprocessor Applications. Dr. Ralph Barrera. Assignment (4)

University of Dayton. Electrical & Computer Engineering. ECE 536 Microprocessor Applications. Dr. Ralph Barrera. Assignment (4) University of Dayton Electrical & Computer Engineering ECE 536 ications Dr. Ralph Barrera Assignment (4) Student Name: Saleh Alshahry Student ID #: 1011787550 8-Bit Processor Application. 1) Matrix LED

More information

Interrupts, timers and counters

Interrupts, timers and counters Interrupts, timers and counters Posted on May 10, 2008, by Ibrahim KAMAL, in Micro-controllers, tagged Most microcontrollers come with a set of ADD-ONs called peripherals, to enhance the functioning of

More information

Parallel IO. Serial IO. Parallel vs. Serial IO. simplex vs half-duplex vs full-duplex. Wires: Full Duplex. Wires: Simplex, Half-duplex.

Parallel IO. Serial IO. Parallel vs. Serial IO. simplex vs half-duplex vs full-duplex. Wires: Full Duplex. Wires: Simplex, Half-duplex. Parallel IO Parallel IO data sent over a group of parallel wires. Typically, a clock is used for synchronization. D[15:0] clk Serial IO Serial IO data sent one bit at a time, over a single wire. A clock

More information

AN587. Interfacing to an LCD Module. Interfacing to an LCD Module INTRODUCTION OPERATION CONTROL SIGNAL FUNCTIONS TABLE 2: CONDITIONAL ASSEMBLY FLAGS

AN587. Interfacing to an LCD Module. Interfacing to an LCD Module INTRODUCTION OPERATION CONTROL SIGNAL FUNCTIONS TABLE 2: CONDITIONAL ASSEMBLY FLAGS Interfacing to an LCD Module AN587 INTRODUCTION TABLE 1: CONTROL SIGNAL FUNCTIONS This application note interfaces a PIC16CXX device to the Hitachi LM02L LCD character display module. This module is a

More information

The University of Texas at Arlington Lecture 21_Review

The University of Texas at Arlington Lecture 21_Review The University of Texas at Arlington Lecture 21_Review CSE 5442/3442 Agenda Tuesday December 1st Hand back Homework 7,8 and 9. Go over questions and answers Exam 3 Review Note: There will be a take home

More information

C and Embedded Systems. So Why Learn Assembly Language? C Compilation. PICC Lite C Compiler. PICC Lite C Optimization Results (Lab #13)

C and Embedded Systems. So Why Learn Assembly Language? C Compilation. PICC Lite C Compiler. PICC Lite C Optimization Results (Lab #13) C and Embedded Systems A µp-based system used in a device (i.e, a car engine) performing control and monitoring functions is referred to as an embedded system. The embedded system is invisible to the user

More information

PIC16F8X. 8-Bit CMOS Flash/EEPROM Microcontrollers PIC16F8X PIC16CR8X. Pin Diagram. Devices Included in this Data Sheet:

PIC16F8X. 8-Bit CMOS Flash/EEPROM Microcontrollers PIC16F8X PIC16CR8X. Pin Diagram. Devices Included in this Data Sheet: This document was created with FrameMaker 404 PIC16F8X 8-Bit CMOS Flash/EEPROM Microcontrollers Devices Included in this Data Sheet: PIC16F83 PIC16CR83 PIC16F84 PIC16CR84 Extended voltage range devices

More information

Embedded Systems. PIC16F84A Internal Architecture. Eng. Anis Nazer First Semester

Embedded Systems. PIC16F84A Internal Architecture. Eng. Anis Nazer First Semester Embedded Systems PIC16F84A Internal Architecture Eng. Anis Nazer First Semester 2017-2018 Review Computer system basic components? CPU? Memory? I/O? buses? Instruction? Program? Instruction set? CISC,

More information

EEE394 Microprocessor and Microcontroller Laboratory Lab #6

EEE394 Microprocessor and Microcontroller Laboratory Lab #6 Exp. No #6 Date: INTERRUPTS AND ADC IN PIC MICROCONTROLLER OBJECTIVE The purpose of the experiment is to configure external interrupt and the ADC in PIC microcontrollers. (i) To flip the LED connected

More information

Weekly Report: Interactive Wheel of Fortune Week 4 02/014/07-02/22/07 Written by: Yadverinder Singh

Weekly Report: Interactive Wheel of Fortune Week 4 02/014/07-02/22/07 Written by: Yadverinder Singh Work Completed: Weekly Report: Interactive Wheel of Fortune Week 4 02/014/07-02/22/07 Written by: Yadverinder Singh Last week started with the goal to complete writing the overall program for the game.

More information

expandio-usb TM Summary USB Features I/O Expander Command Set Applications Peripheral Features Firmware Factory USB Product Family

expandio-usb TM Summary USB Features I/O Expander Command Set Applications Peripheral Features Firmware Factory USB Product Family Summary expandio-usb is an ultra-low cost USB I/O expander It allows a PIC microcontroller to be remotely controlled via USB, significantly reducing time-to-market for simple USB-based products expandio-usb

More information

PIC16C84. 8-bit CMOS EEPROM Microcontroller PIC16C84. Pin Diagram. High Performance RISC CPU Features: CMOS Technology: Peripheral Features:

PIC16C84. 8-bit CMOS EEPROM Microcontroller PIC16C84. Pin Diagram. High Performance RISC CPU Features: CMOS Technology: Peripheral Features: 8-bit CMOS EEPROM Microcontroller High Performance RISC CPU Features: Only 35 single word instructions to learn All instructions single cycle (400 ns @ 10 MHz) except for program branches which are two-cycle

More information

unsigned char ReadADC() { /************* start A/D, read from an A/D channel *****************/ unsigned char ADC_VALUE;

unsigned char ReadADC() { /************* start A/D, read from an A/D channel *****************/ unsigned char ADC_VALUE; /*********************************************************************************************/ /* BME 361 Biomeasurement Lab - PIC18F4525BT Demo */ /* Laboratories 1-8: A/D, D/A, LCD display, ECG simulation,

More information

unsigned char ReadADC() { /************* start A/D, read from an A/D channel *****************/ unsigned char ADC_VALUE;

unsigned char ReadADC() { /************* start A/D, read from an A/D channel *****************/ unsigned char ADC_VALUE; /*********************************************************************************************/ /* BME 361 Biomeasurement Lab - PIC18F4525BT Demo */ /* Laboratories 1-8: A/D, D/A, LCD display, ECG simulation,

More information

PIC16F8X 18-pin Flash/EEPROM 8-Bit Microcontrollers

PIC16F8X 18-pin Flash/EEPROM 8-Bit Microcontrollers 18-pin Flash/EEPROM 8-Bit Microcontrollers Devices Included in this Data Sheet: PIC16F83 PIC16F84 PIC16CR83 PIC16CR84 Extended voltage range devices available (PIC16LF8X, PIC16LCR8X) High Performance RISC

More information

The MICROPROCESSOR PRINCIPLES AND APPLICATIONS Lab 7

The MICROPROCESSOR PRINCIPLES AND APPLICATIONS Lab 7 The MICROPROCESSOR PRINCIPLES AND APPLICATIONS Lab 7 Timer, USART Cheng-Chien Su 蘇正建 Home Automation, Networking, and Entertainment Lab Dept. of Computer Science and Information Engineering National Cheng

More information

Digital pulse sensors

Digital pulse sensors Digital pulse sensors Incremental encoders, angle Mechanical sensing Optical sensing Luxury variant Lågpriskomponenten Lowest Price 2 Optical fork coupler 2 spring contacts Contact pattern Hole/slit disc

More information

EE 361L Digital Systems and Computer Design Laboratory

EE 361L Digital Systems and Computer Design Laboratory EE 361L Digital Systems and Computer Design Laboratory University of Hawaii Department of Electrical Engineering by Galen Sasaki and Ashok Balusubramaniam Quick Overview of PIC16F8X Version 1.0 Date: 9/4/01

More information

These 3 registers contain enable, priority,

These 3 registers contain enable, priority, 8.3.2) Registers Related to Interrupts These registers enable/disable the interrupts, set the priority of the interrupts, and record the status of each interrupt source. RCON INTCON, INTCON2, and INTCON3

More information

PIC16C63A/65B/73B/74B

PIC16C63A/65B/73B/74B PI663A/65B/73B/74B 4.0 MEMORY ORGANIATION 4. Program Memory Organization The PI663A/65B/73B/74B has a 3bit program counter capable of addressing an 8K x 4 program memory space. All devices covered by this

More information