Pro1at Code Sample

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Pro1at Code Sample as PDF for free.

More details

  • Words: 361
  • Pages: 3
PROYECTO: CONTROL DE UN MOTOR REVERSIBLE CON Atmega8 BAd BP °

FC1 °

°

°

°

R1 BAi °

°

Diagrama eléctrico escalera

°

FC2 °

R1

R2 FC2

°

FC

R1

FC1 = N.C.

FC2 = N.C.

Bad = N.A. Bai = N.C.

Bad = Ir a la derecla

Bai = Ir a la izquierda

CONEXIÓN EN PUERTOS DEL AVR Atmega8

AVR Atmega8

5 Vdc

cargas pequeñas poner transistores de potencia a buffers

R1

BAd 10 K

pc0 - PIN 23

pd0 - PIN 2

BAi

R2 10 K

pc1 - PIN 24

pd1 - PIN 3

FC1 10 K

FC2

10 K

pc2 - PIN 24

pc3 - PIN 26

puerto d salidas

puerto c entradas

By Mtro. Carlos M. Ruvalcaba B.

Automatización - CUCEI

Bad = N.A ; Bai = N.A. FC1 = N.A. FC2 = N.A.

Programa editado en AVR Studio 4 y ensamblado en pony program 2000 .include"M8def.inc" .cseg .org 0 .def temp = r16 rjmp reset reset: ldi temp,low(ramend) out spl,temp ldi temp, high(ramend) out sph,temp ldi temp,$FF ldi r19,$01 ; boton bad oprimido ldi r20,$02 ; boton bai oprimido ldi r21,$04 ; fc1 en la derecha actuado ldi r22,$08 ; fc2 en la izquierda actuado ldi r25,$06 ldi r26,$09 ldi r27,$00 micros0:

cualquiera:

in r24,pinc cp r24,r27 breq cero nop in r24, pinc cp r24, r25 breq uno nop in r24, pinc cp r24, r26 breq dos nop rjmp cualquiera

cero1: ldi r18, $00 out portd, r18 cero: in r24, pinc ; espera un boton fc1 y fc2 = 0 By Mtro. Carlos M. Ruvalcaba B.

Automatización - CUCEI

cp r24, r19 ; 01 se oprimio bad breq uno in r24, pinc ; 02 se oprimio bai cp r24, r20 breq dos in r24, pinc cp r24, r25 ; fc1 y boton bai accionado breq dos in r24, pinc cp r24, r26 breq uno rjmp cero uno: ldi r18, $01 out portd, r18 rjmp fc1 dos: ldi r18, $02 out portd,r18 rjmp fc2 fc1: in r24, pinc sbrs r24, 2 rjmp fc1 rjmp cero1 fc2: in r24, pinc sbrs r24, 3 rjmp fc2 rjmp cero1

By Mtro. Carlos M. Ruvalcaba B.

Automatización - CUCEI

Related Documents

Pro1at Code Sample
November 2019 2
Share Point Sample Code
April 2020 14
Share Point Sample Code
April 2020 22
Interrupt Sample Code
May 2020 12
Code
June 2020 11