• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
EMBEDDED SYSTEMS 5
 

EMBEDDED SYSTEMS 5

on

  • 856 views

 

Statistics

Views

Total Views
856
Views on SlideShare
856
Embed Views
0

Actions

Likes
0
Downloads
3
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    EMBEDDED SYSTEMS 5 EMBEDDED SYSTEMS 5 Presentation Transcript

    • DIGITAL I/O
    • I/O Programming
      • 4 ports for I/o Programming
        • Port 0 0x80
        • Port 1 0x90
        • Port 2 0xA0
        • Port 3 0xB0
    • Secret of Port 0
      • Port 0 has no pull up resistors
      • Reason?
        • Due to the purpose of Port 0 as data and address holder , it cannot have a resistor in the output pins.
        • By directly giving the supply of 5 v to the port 0 will damage the internal transistor eventually.
      • Solution :
        • By connecting external pull up resistor in a range of 1K to 10K ohms , the damage to the internal transistor can be avoided.
    • Try to Avoid Port 3
      • Port 3 is also called as multifunctional port.
      • It is used for serial communication, timer, external interrupt, chip read and write.
      • Therefore by using port 3 in a situation under which a serial communication or connecting an external memory which will cause loss of data or misbehavior in the output.
      • Also the timer and interrupts are very sensitive to the crystal frequency.
    • Remaining for I/O programming
      • The remaining for I/O programming are Port 1 and Port 2 only.
      • Port 1 is a simple bidirectional Port
      • Port 2 is also a bidirectional with MSB of 16 bit address
      • Remember that port 2 is in reverse order while looking aerially
    • C programming of I/Os
      • Key word for accessing I/Os
          • sbit a single bit ---------|
          • sfr eight bit ____ |----- for accessing I/O directly
          • bit a single bit-----|----|
          • sfr 16 16 bit-----------|-----------for acessing I/O indirectly
    • Giving to Ports & Getting from the Ports
        • You can set a particular port with the help of the keyword
        • “ sbit”
        • Eg.,
        • sbit my_key =P1^1;
        • Explanation: my_key is the user defined variable which can be used to get or send data to 2 nd PIN of Port 1.
        • ^ symbol is used to mention a particular PIN any port
    • Use of bit
      • “ bit ” is another single bit keyword which is used to change the value for the variable which is assigned by the sbit keyword.
      • Rather we can simply use it for “Boolean operation”.
      • Eg., bit garbage;
          • garbage =1;
          • while(1)
          • {
          • garbage = ~garbage;
          • my_key = garbage
          • }
          • Explanation: garbage is a user defined variable which can only be used as either ‘0’ or ‘1’
    • Sfr made for??
      • “ sfr ” is an eight bit keyword, which allows user to set a 8-bit value.
      • Most of the registers in uC are 8-bit registers.
      • Therefore it is easy to use all 8-bit register using the “ sfr ” keyword.
        • Eg., sfr myport=0x80;
        • Explanation: Here myport is a user defined variable which is assigned to get or send value through PORT 0 (since port 0 is located in 0x80 address).
        • This is not only for ports, but also all register(TCON, SBUF, PCON, etc.,) can be assessed like this.
    • What about 16-bit registers???
      • Still there are some registers which have 16-bit .
      • Therefore to access those 16-bit registers, sfr16 has to be used.
      • The only 16-bit register which can be often used is DataPoinTeR (DPTR)
      • sfr16 can be used to assign that DPTR register.
    • Delay is the main concept..
      • After the infinite loop concept, Delay is another important thing in the embedded system.
      • There are different type of delays available in microcontroller
      • By using the I/O concept delay can be produced.
      • Basic of delay is no operation for a particular period.
      • Here we providing that concept via programming
      • Therefore we can call this kind of delays as “ software delays ”
    • Simple delay program
            • int i,j;
            • for(i=0;i<250;i++)
            • {
            • for(j=0;j<1275;j++)
            • {
            • ;
            • }
            • }
            • This will generate approximately 1 sec delay.
            • Software delays are only approximate figures.
    • A simple I/O programming
      • #include<reg51.h>
      • sbit book = P1^2; //port 1 – 3 rd pin
      • sfr select =P0; //port 0
      • void main()
      • {
      • book=1; // as an input
      • bit name =1; // single bit declaration
      • while(1)
      • {
      • if(book==1) // condition check in port 1 – 3 rd pin
      • {
      • book=~name; //changing the value for book
      • Select=0x55; //sending the output to port 0
      • }
      • }
      • }
      • Try to do an arithmetic operation using I/O concept.
      • Do a Fibonacci series using delay and I/O concept
      • Made a Boolean table for any logic operation