Configure As Input/Output The Ports Of The Microcontroller Pic18F4550

Páginas: 5 (1018 palabras) Publicado: 4 de junio de 2012
| | |
| Subject: | DIGITAL SYSTEMS 2 | |
| Student: | | |
| Practice Name | SIMULATING DIGITAL SYSTEMS | |
| | |
| Practice Number | 2 | Length (Hours) | 2 | |
| | |
| OBJECTIVE (Learning result)The student will be able to configure as input/output the ports of the microcontroller PIC18f4550 as well as to manage Byte and Bit oriented instructions. | |
| ||
| THEORETICAL FRAMEWORK * Main features of PIC 18F4550ADC, USB, UART, USART, CAN, Parallel communication for master and slave pics * Define: free-run counter, High impedanceA free run counter is a kind of count were the lop is running all the time but in a specific time it start from the beginning. The high impedance allow us to connect many circuits that probably need be unplug sometimes, in other words, the high impedance can open the wire in any moment. * Perform the following numerical conversions: * AAF0 to Binary: 1010 1010 1111 0000 * F503 to Binary: 1111 0101 0000 0011 * ECEB to Binary: 1110 1100 1110 1011 * 1001 1010 to Hexadecimal: 9A * 1000 0101 to Hexadecimal: 85 * 0110 1100 to Hexadecimal: 6C * 1110 0010 to Hexadecimal: E2 | |
| | |
|MATERIALS AND EQUIPEMENT Software: ISIS Professional, PIC C compiler. | |
| | |
| METHODOLOGY1.- Type the source code “My first C program”#INCLUDE <18f4550.h>#FUSES XT, NOWDT, NO PROTECT#use delay(clock=4000000)VOID main(){ WHILE (true) { output_high (pin_b0); delay_ms (100); output_low (pin_b0); delay_ms (100); }} 2.- Identify and explain each oneof the following lines of code:a) Pre-processor directive which indicates the microcontrollerIs in this part were the characteristics of the microcontroller will be declared to use.b) Clock frequencyTells to the microcontroller in which frequency is going to work.c) Fuse XTIndicate the type of oscillatord) Main functionIs where all the main code are.e) Infinite loopThe aim of this loop isrestart all the cycle.f) No code protection fuseThis fuse protect the code for copies, in other words you couldn`t be able to use that code in other device.3.- Compile the code and write down the output files that are generated4.- Use the software ISIS 7 to simulate this code5.- Modify the code in order to control the direction are a stepper motor by using a single one-bit input (checkpoint)#include<18F4550.h>#fuses XT,NOPROTECT,NOWDT#use delay (clock=4000000)#define time 1000void main(){ while(true) { if(input(pin_A0)==1&&input(pin_A1)==0)//El pin a0 es el de encendido y apagado { //y el pin a1 es el de dirección izquierda y derecha output_b(0x01); delay_ms(time); output_b(0x02); delay_ms(time);output_b(0x04); delay_ms(time); output_b(0x08); delay_ms(time); } if(input(pin_A0)==1&&input(pin_A1)==1) { output_b(0x01); delay_ms(time); output_b(0x08); delay_ms(time); output_b(0x04); delay_ms(time); output_b(0x02); delay_ms(time); } }} 6.- Build the schematic andsimulate the free-run counter (check point)7.- Modify the code in order to control the direction of a stepper motor by using a single one-bit input (check point)#INCLUDE <18f4550.h>#FUSES NOWDT,XT,NO PROTECT#use delay(clock=4000000)#define time 200VOID main(){ INT a = 0; //adelante WHILE (true) { IF (input (pin_a0)) a = 1; ELSE a=0; IF (a == 1) { output_c(0x01);output_b (0x01); delay_ms (time); output_b (0x02); delay_ms (time); output_b (0x04); delay_ms (time); output_b (0x08); delay_ms (time);} ELSE { output_c(0x02); output_b (0x08); delay_ms (time); output_b (0x04); delay_ms (time); output_b (0x02); delay_ms (time);...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Terrorism As Portrayed In The Character Of The Joker In The Knight Of The Dark Night
  • the house of the sea
  • The expansi n of Diplomatics as discipline
  • Fukuyama's declaration of capital democracy as the absolute political regime as the collapse of socialism
  • The lord of the rings
  • The cooking of the books
  • the phantom of the opera
  • the secret of the swtones

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS