Autor Tema: PIC16F84A enviar dos bytes por linea serie  (Leído 1270 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado ozumet

  • PIC10
  • *
  • Mensajes: 1
PIC16F84A enviar dos bytes por linea serie
« en: 07 de Junio de 2006, 11:36:43 »
Hola!

Quiero mandar 2 bytes, guardados en dos registros, por la linea serie y recibirlos en el Hyperterminal. El primero
me llega bien pero el segundo no. Hay que hacer algo en especial para mandar este segundo byte??

Muchas gracias. :-/ :-/ :-/

Abajo adjunto el codigo que tengo para posibles correcciones .

   List p=16F84A
   include "P16F84A.INC"
   
;*******************************************************************************   
;      DECLARACION DE VARIABLES
;*******************************************************************************

START_OF_VARIABLES   EQU   0x0C

   CBLOCK   START_OF_VARIABLES

varTemp1
varTemp2
aux1
aux2
aux     
array
   
   ENDC

   org 0x00
   goto Inicio
   org 0x05


data_bidali_konf:         clrf PORTB                       bsf STATUS,RP0      
               clrf TRISB      ;Sarrerak garbitzen ditu
               movlw b'11111011'   ;RB2 irteera moduan konfiguratzen dogu
               movwf TRISB      ;Konfigurazioa jartzen du
               return

;*******************************************************************************
;         DELAY, 14ms-ko RETARDUA
;*******************************************************************************

delay_14ms:   clrwdt
         movlw 0x60         ;ejecutaremos el bucle 87 veces 57hex--->87dec
         movwf varTemp1
         
Bucle_Del1   movlw 0x30         ;ejecutaremos el bucle 256 veces
         movwf varTemp2
      
Bucle_Del2   DECFSZ varTemp2         ;decrementamos el valor de variable xa k actue como bucle
         goto Bucle_Del2
         decfsz varTemp1
         goto Bucle_Del1         

   return

;*******************************************************************************
;         DELAY, 1s-ko RETARDUA
;*******************************************************************************

delay:      clrwdt
         movlw 49        ;Repite la rutina DELAY10 (de 10 mS) 100
           movwf aux1       ;veces
hasiera_d  CALL delay_14ms
            DECFSZ aux1
            goto hasiera_d   
           return

;*******************************************************************************
;abiadura = 9600 baudio, beraz T = 104 micro seg.bidali beharreko biten artean, T
;*******************************************************************************

delay_bidali:   clrwdt
            movlw d'30'         
            movwf varTemp1
      
bukle   DECFSZ varTemp1         
         goto bukle         
         return

Inicio CALL data_bidali_konf

      bcf array,0
      RLF array
      bsf array,0
      RLF array
       bsf array,0
      RLF array
       bcf array,0
      RLF array
       bcf array,0
      RLF array
       bcf array,0
      RLF array
       bsf array,0
      RLF array
       bcf array,0
     
;BIDALI
   movlw 0x07
   movwf aux

   bcf STATUS,RP0
   bcf PORTB,2
   CALL delay_bidali

ona   bcf STATUS,RP0
   BTFSC array,0
   goto bat
   goto zero

bat   bsf PORTB,2
   CALL delay_bidali
   RRF array
   DECFSZ aux
   goto ona
   goto azkena

zero bcf PORTB,2
   CALL delay_bidali
   RRF array
   DECFSZ aux
   goto ona
   goto azkena

azkena BTFSC array,0
      goto bat_1
      goto zero_1

bat_1 bsf PORTB,2
     CALL delay_bidali
     goto bukaera

zero_1 bcf PORTB,2
     CALL delay_bidali
     goto bukaera

bukaera bsf PORTB,2
      CALL delay_bidali
      CALL delay_bidali

;*****************************
   movlw 0x07
   movwf aux

   bcf STATUS,RP0
   bcf PORTB,2
   CALL delay_bidali

ona_2   bcf STATUS,RP0
   BTFSC array,0
   goto bat_2
   goto zero_2

bat_2   bsf PORTB,2
   CALL delay_bidali
   RRF array
   DECFSZ aux
   goto ona_2
   goto azkena_2

zero_2 bcf PORTB,2
   CALL delay_bidali
   RRF array
   DECFSZ aux
   goto ona_2
   goto azkena_2

azkena_2 BTFSC array,0
      goto bat_1_2
      goto zero_1_2

bat_1_2 bsf PORTB,2
     CALL delay_bidali
     goto bukaera_2

zero_1_2 bcf PORTB,2
     CALL delay_bidali
     goto bukaera_2

bukaera_2 bsf PORTB,2
      CALL delay_bidali
      CALL delay_bidali
   end