Anglicky v odborných předmětech " Support of teaching technical subjects in English “

10 pages

Please download to get full document.

View again

of 10
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Anglicky v odborných předmětech " Support of teaching technical subjects in English “. Training program: Mechanic - electrotechnician Program name: Digital processing - microprocessors III. class Microcontrollers Elaborated by: Vlastimil Vlček.
Anglicky v odborných předmětech"Support of teaching technical subjects in English“Training program: Mechanic - electrotechnicianProgram name: Digital processing - microprocessors III. class MicrocontrollersElaborated by: Vlastimil VlčekProjekt Anglicky v odborných předmětech, CZ.1.07/1.3.09/04.0002je spolufinancován Evropským sociálním fondem a státním rozpočtem České republiky.PORTS from a programmer´s point of view
  • They are used for communication of a microcontroller with its environment (the only pins brought out of the package, apart from the power supply and the circuit of the oscillator).
  • They are mapped into the address space of the data memory (they belong to special function registers – see the list of SFRs).
  • Data downstream through the ports is software programmable - at the level of individual bits of a port.
  • The RE3 bit can be used only as an input (standardlyMCLR)!
  • PIC16F883 PORTSIllustration of a table (PIC16F883 datasheet) describing the function of pins in individual ports.All pins (except for pins No8,19, 20) can be used as common digital I/O lines or can have a different function – see the table.The function of pins is software selectable (also during the program run).Pins No 8,19, 20 are supply pins. The RA3 pin is only an input pin!Data downstream is determined by writing into the TRIS registers.Setup of data downstream through the ports – TRIS registersI = INPUT (data in)O = OUTPUT (data out)Memotechnic device:1 = I = INPUT0 = O = OUTPUTIt is possible to set up the data downstream for each port separately. This can be done whenever, even during the program run. Ports – block diagramFlip-flop circuits of the D type form so-called output “latch” register. The data written from the data bus are, at the I/O pin, released only after the gate (controlled by the TRIS register output) opens.Initialization of portsInitialization of ports is carried out at the start of a program:
  • Setup of a port type (analog or digital)
  • Setup of the data downstream of individual bits of the port
  • An example of a program in assembler for the initialization of the A port:
  • BANKSEL ANSEL ;switching off of analog peripherals =>CLRF ANSEL ;all ports = digital I/OCLRF ANSELH BANKSEL TRISA ;setup of the data downstream of the A port:MOVLW B’00001111’ ;RA <7:4> = output, MOVWF TRISA ;RA <3:0> = inputBANKSEL PORTA ;setup of the 0 bank – work with the portsMain principles of working with portsHandling of unconnected input port pins:
  • By means of hardware:
  • Connecting a pin to an earth potential
  • Connecting a pin to the positive power-supply voltage via a resistor
  • By means of software:
  • Setting up a pin to an output mode (attention – then it cannot be earthed!)
  • Protection against the current overload of the output pins:
  • By a limiting resistor
  • By current amplification (a switching transistor)
  • By an insulated separating element (an optomember)
  • Summary of the subject matter
  • What is the role of ports in a microcontroller?
  • How many ports does the PIC16F883 microcontroller contain how are they marked?
  • What is the bit width of a port?
  • Is the data downstream through the ports firmly determined by the internal connection of a microcontroller?
  • Are all the ports and their individual bits always and under all circumstances available?
  • Summary of the subject matter
  • What is the role of the TRIS registers?
  • For what reasons is so-called inicialization of ports carried out?
  • Is it necessary to handle the unconnected pins of a port somehow? If so, how?
  • From the documentation, find out the maximum permissible current of one pin of the port in an output mode and the maximum permissible current of the whole port! What important finding ensues from this information?
  • References
  • Datasheet Microchip PIC16F882/883/884/886/887 DS41291E (
  • Jiří Hrbáček: Mikrořadiče PIC16CXX a vývojový kit PICSTART (BEN – technická literatura, Praha 2001 3. dotisk 4. vydání)
  • Jiří Hrbáček: Komunikace mikrokontroléru s okolím 1 ((BEN – technická literatura, Praha 2002)
  • Related Search
    We Need Your Support
    Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

    Thanks to everyone for your continued support.

    No, Thanks

    We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

    More details...

    Sign Now!

    We are very appreciated for your Prompt Action!