Presentation is loading. Please wait.

Presentation is loading. Please wait.

1. PIC ADC  PIC18F877 has 8 analog input channels i.e. port A pins(RA0 to RA5) and port E pins(RE1 and RE2). These pins are used as Analog input pins.

Similar presentations


Presentation on theme: "1. PIC ADC  PIC18F877 has 8 analog input channels i.e. port A pins(RA0 to RA5) and port E pins(RE1 and RE2). These pins are used as Analog input pins."— Presentation transcript:

1

2 1. PIC ADC  PIC18F877 has 8 analog input channels i.e. port A pins(RA0 to RA5) and port E pins(RE1 and RE2). These pins are used as Analog input pins AIN0 to AIN7. A signal 10 bit ADC.  To select ADC channel set_adc_channel(n) for input ADC channel.  read_adc()- this function is used to read date from ADC. S.no functionsDescription 1set_adc(ADC_CLK_INTERNAL)Initialize ADC 2set_up_ports(Rpx_ANALOG)Initialize pin ‘x’ of port ‘p’ to function as analog input

3 2. PIC Interrupt  There is special method to define the function as an ISR. The directive to indicate an ISR is #int_  E.g- #int_ext

4 3. PIC Timer and Counters  The timer function of timer/counter keeps track of the timer or also helps in generating delays.  Counter mode of operation of a timer/counter helps in counting the number of times an event occurs.

5 Function NameDescription 1setup_timerx( )Used to select mode of the timer ‘x’. 2get_timerx()Used to read the content of timer register. Which will be stored in left side variable of this function. 3set_timerx(n)It loads the value ‘n’ in the timer ‘x’ register. 4setup_ccpx(ccp_pwm)It sets the timer ‘x’ in CCP mode of PWM 5setup_ccpx(ccp_pwm)It sets the timer ‘x’ in CCP mode of capture mode with rising edge 6setup_ccpx(ccp_pwm)It sets the timer ‘x’ in CCP mode of capture mode 7set_pwmx_duty(n)Used to initialize the on time value given by ‘n’ for the PWM mode of operation of the CCP.

6 4. PIC UART Programming  PIC supports the RS232 port for serial communication.  RXD and TXD pins used for this communication. FunctionDescription 1setup_uart(n)It sets bound rate of the UART port to the value given 2putc(n)It sends the data ‘n’ passed to the function on the serial link connected on the TXD 3getc()It reads data received on the serial port i.e. RXD

7 5. SPI Serial Bus  Serial Peripheral Interface (SPI) normally is preffered for the program transfer and other huge data communication from microcontroller and it is high speed communication Functiondescription 1setup_spi(spi_master) Or setup_spi(spi_slave) Used to initialize the SPI port in master or slave mode 2spi_read()Used to accept data received by SPI port. 3spi_write(n)Used to transfer character byte ‘n’.

8 6. PIC I2C Serial Bus  It is single wire communication for both the direction. functiondescription 1i2c_write(n)It transfers the byte data ‘n’ passed to the function on the serial port of I2C 2i2c_read()It reads byte data from serial port of I2C. 3i2c_stop()It issues a stop command when in the master mode.

9 7.Parallel Slave Port (PSP) FunctionDescription 1 psp_input_full() It returns Boolean type of data i.e. true or false. Return value depend on whether i/p is received from PSP or not. 2 psp_output_full() It checks if the output for the PSP port is ready to go or not. 3 output_x(n) To output the data 4 input_x() Used to accept data from port 5 setup_psp(PSP_ENABLE D) Used enable or disable PSP port 6 set_tris_e(n) Used to set data direction of the PSP port. 7 psp_overflow() Check the error on data overflow

10  It mainly involves driving motors(like stepper motors, DC motor, servo motors etc.), interfacing displays (like LCD, LED), interfacing sensors.  Interfacing DC  Interfacing Stepper Motor  Temperature  Sensor LM35

11 Interfacing DC Motor

12  Temperature Sensor LM35  It is used to convert temperature value to an electrical value.  LM35 are precision integrated circuit temperature sensors, whose output voltage is proportional to the Celsius temperature.

13 Temperature Sensor LM35

14

15


Download ppt "1. PIC ADC  PIC18F877 has 8 analog input channels i.e. port A pins(RA0 to RA5) and port E pins(RE1 and RE2). These pins are used as Analog input pins."

Similar presentations


Ads by Google