alc_sol_man_ch07

alc_sol_man_ch07 - Solutions Manual 7.1 PIC16F84 1 2 3 RA2...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Solutions Manual Introduction to Mechatronics and Measurement Systems 53 7.1 list p=16f84 include <p16F84.inc> ; Define counter variable locations c1 equ 0x0c c2 equ 0x0d c3 equ 0x0e ; Initializes PORTA to output all zeros bcf STATUS, RP0 ; select bank 0 clrf PORTA ; initialize all pin values to zero bsf STATUS, RP0 ; select bank 1 clrf TRISA ; designate all PORTA pins as outputs bcf STATUS, RP0 ; select bank 0 ; Main program loop start bsf PORTA, 0 ; turn on the LED connected to RA0 call pause ; pause for 1 second bcf PORTA, 0 ; turn off the LED connected to RA0 call pause ; pause for 1 second goto start PIC16F84 RA2 RA3 RA4 MCLR Vss RB0 RB1 RB2 RB3 RA1 RA0 OSC1 OSC2 Vdd RB7 RB6 RB5 RB4 1 2 3 4 5 6 7 8 91 0 11 12 13 14 15 16 17 18 5V 22 pF 22 pF 4 MHz 1 k 5V 0.1 F µ 330 LED
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Solutions Manual 54 Introduction to Mechatronics and Meaurement Systems ; Subroutine to pause for approximately 1 second pause ; Initialize counter variables movlw 0x00 movwf c1 movlw 0x00 movwf c2 movlw 0xFA movwf c3 loop incfsz c1, F goto loop incfsz c2, F goto loop incfsz c3, F goto loop return ; end of subroutine end ; end of instructions 7.2 PIC16F84 RA2 RA3 RA4 MCLR Vss RB0 RB1 RB2 RB3 RA1 RA0 OSC1 OSC2 Vdd RB7 RB6 RB5 RB4 1 2 3 4 5 6 7 8 91 0 11 12 13 14 15 16 17 18 5V 22 pF 22 pF 4 MHz 1 k 5V 0.1 F µ 330 LED NO 5V
Background image of page 2
Solutions Manual Introduction to Mechatronics and Measurement Systems 55 ’ Program to turn an LED on and off at 1 Hz while a pushbutton switch is being held down ’ Define variable names for the I/O pins my_button Var PORTB.0 my_led Var PORTA.0 begin: While (my_button == 1) ’ while the switch is held down ’ Turn on the LED High my_led ’ Wait for 1/2 sec Pause 500 ’ Turn off the LED Low my_led ’ Wait for 1/2 sec Pause 500 Wend Goto begin ’ continue End ’ end of instructions 7.3 ’ Program to perform the functionality of the Pot statement ’ assumed variables: pin: I/O pin identifier scale: byte variable containing maximum time constant var: byte variable containing measured time constant ’ Charge the capacitor High pin Pause scale
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/09/2009 for the course MEEN 433 taught by Professor W.j.kim during the Summer '09 term at Texas A&M.

Page1 / 8

alc_sol_man_ch07 - Solutions Manual 7.1 PIC16F84 1 2 3 RA2...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online