Hola! es mi primer contacto con SOLOCODIGO y como veo el nivel es buenisimo, les cuento que estoy intentando hacer funcionar un RTC ds1307 y al leerlo me devuelve solo "ceros". lo leo en el hiperterminal pero no funciona. se que arranca porque en la dir. 07 que es la de control me reconoce el comando para generar un pulso por segundo. aca les mando mi preog en ensamblador para que me cuenten si le falle en algo y si alguien sabe si el "C" de buider es el mismo que se utiliza para programar PIC. desde ya mil gracias. 
;==========================================
;ojo! ya se que tiene un tx y rx el 628 pero yo lo hice ;tambien para q trabaje en un f84
 LIST P=16f628
;lee rtc y transmite por txbuf
;  sdata puerto b,3
;  sclk    puerto b,4
;==========================================
indef   EQU     00h
tmr0   EQU     01h
pcl   EQU     02h
status   EQU     03h
fsr   EQU     04h
ptoa   EQU     05h
ptob   EQU     06h
pclath   EQU     0Ah
intcon   EQU     0Bh
pir1   EQU     0Ch
tmr1l   EQU     0Eh
tmr1h   EQU     0Fh
t1con   EQU     10h
tmr2   EQU     11h
t2con   EQU     12h
ccpr1l   EQU     15h
ccpr1h   EQU     16h
ccp1con   EQU     17h
rcsta   EQU     18h
txreg   EQU     19h
rcreg   EQU     1Ah
cmcom   EQU     1Fh
opcion   EQU     81h
trisa   EQU     85h
trisb   EQU     86h
pie1   EQU     8Ch
pcon   EQU     8Eh
pr2   EQU     92h
txsta   EQU     98h
spbrg   EQU     99h
dato   EQU     9Ah
direccion   EQU     9Bh
eecon1   EQU     9Ch
eecon2   EQU     9Dh
vrcon   EQU     9Fh
rxbuff   equ     21h
txbuf   equ    22h
addr   equ    23h
datao   equ    24h
slave   equ    0xd0
count   equ    26h
eeprom   equ    27h
di      equ 7
do      equ 6
sdata      equ 3
sclk      equ 4
j2          equ 7
j1      equ 6
led      equ 2
clear      equ 1
mande      equ 0
clk      equ 0
cs      equ 2
in      equ 1
start      equ 3
recep      equ    28h
r19      equ    29h
r1a      equ    2ah
trans      equ   2bh
loops      equ   2ch
loops2      equ   2dh
Segundo      equ   2eh
Hora      equ   2fh
Minuto      equ   30h
DiaSemana   equ   31h
Dia      equ   32h
Mes      equ   33h
Año      equ   34h
unidad      equ   35h
decena      equ   36h
centena      equ   37h
r199      equ   38h
valor1   equ   .8
valor2   equ   .104
valor3   equ   .119
reg1   equ   39h
reg2   equ   3ah
reg3   equ   3bh
mkm1   equ   3ch
mkm2   equ   3dh
mkm3   equ   3eh
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
reset
   org      0
   goto   inicio
   org   5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
retardo
   clrw
   movlw   valor1
   movwf   reg1
tre3
   movlw   valor2
   movwf   reg2
do2   
   movlw   valor3
   movwf   reg3
un1
   decfsz   reg3,1
   goto   un1
   decfsz   reg2,1
   goto   do2   
   decfsz   reg1,1
   goto   tre3   
   return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;RETARDO;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
delay1
   movlw   .166    ;es 166
    movwf   r19
redo   
   nop
   nop
   decfsz   r19
   goto   redo
   retlw   0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ms47   movlw   .7    
    movwf   r199
red   
   nop
   nop
   decfsz   r199
   goto   red
   retlw   0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
bstart
   bsf      status,5
   movlw      b'00000001'
   movwf      trisb
   bcf      status,5   
   bsf      ptob,sdata
   bsf      ptob,sclk
   nop
   nop
   nop   
   nop
   bcf      ptob,sdata
   call   ms47
   return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
bstop
   bsf      status,5
   movlw      b'00000001'
   movwf      trisb
   bcf      status,5
   bcf      ptob,sclk
   bcf      ptob,sdata
   bsf      ptob,sclk
   nop
   nop
   nop
   nop
   bsf      ptob,sdata
   call   ms47
   return
;;;;;;;ENVIA 1 BYTE COMP HACIA  EL RTC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
escrib   movwf      txbuf
   movlw      .8
   movwf      count
txlp   
   bcf      ptob,sclk
   rlf      txbuf,1
   bcf      ptob,sdata
   btfsc      status,0
   bsf      ptob,sdata
   call   ms47
   bsf      ptob,sclk
   nop
   nop
   nop
   nop
   decfsz      count,1
   goto      txlp
;chequeo bit---ack--------------------------------------------------------------
   bcf      ptob,sclk
   bsf      ptob,sdata
   call   ms47
   bsf      ptob,sclk
   nop
   nop
   nop
   nop
   bsf      status,5
   movlw      b'00001001'
   movwf      trisb
   bcf      status,5
arr   btfsc      ptob,sdata
   goto      arr
   bsf      status,5
   movlw      b'00000001'
   movwf      trisb
   bcf      status,5
   bcf      ptob,sclk   
   return               
;;;;;;;RECIBE 1 BYTE COMP DESDE EL RTC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;
leer
   bsf      status,5
   movlw      b'00001001'
   movwf      trisb
   bcf      status,5
   clrf      rxbuff
   movlw      .9
   movwf      count
rxlp   bcf      ptob,sclk
   call   ms47
   bsf      ptob,sclk
   nop
   nop
   nop
   nop
   bcf      status,0
   bsf      status,5
   movlw      b'00001001'
   movwf      trisb
   bcf      status,5
   btfsc      ptob,sdata
   bsf      status,0
   rlf      rxbuff,1
   bsf      status,5
   movlw      b'00000001'
   movwf      trisb
   bcf      status,5
   decfsz      count,1
   goto      rxlp
   bsf      status,5
   movlw      b'00000001'
   movwf      trisb
   bcf      status,5
   retlw      0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
inicio   clrf   ptoa
   bsf   status,5
   bcf   status,6
   movlw   b'00000001' 
   movwf   trisb
   movlw   b'10000'
   movwf   trisa
   movlw   b'10000111'   ;desab res y /256
   movwf   opcion
;   movlw   b'00100110'    ;parametros de comunicacion,,1 maestro,0 8bit,1 hab trans,0 asinc,0 x, 1hy speed,buff vacio
;   movwf   txsta ;
;   movlw   .103       ;9600 baudios 
;   movwf   spbrg
;   movlw   b'00100000'   ; hab permiso de escrit
;   movwf   pie1
;   movlw   b'00000000'
;   movwf   vrcon
   bcf   status,5
   movlw   b'10010000'
   movwf   intcon   
;   movlw   b'00000000'
;   movwf   rcsta
;   bsf   rcsta,7 ;spen¡1 hab pto serie
;   movlw   b'00000000'
;   movwf   pir1   
   movlw   b'00000111'
   movwf   cmcom
;   bsf   pir1,4 ;activo bandera de TRANSM.
;   call   ms47
;   goto   carga_inicial
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;   call   carga_inicial
;   call   escribir
;--------------------------------------------------------------------------------------;
;--------------------SUBRUTINA DE CARGA INICIAL DEL DISPOSITIVO------------------------;
carga_inicial              call   bstart
            movlw   b'11010000'      ; Dirección esclavo DS1307 (Escritura)
            call   escrib         
            movlw   b'00000111'      ; Se indica que se va a enviar el dato a la posicion 07h.
            call   escrib      ; que corresponde al control de la señal cuadrada
            movlw   b'00010000'      ; Se mueve b'00010000' que corresponde a señal cuadrada de 1 Hz
            call   escrib
            call   bstop   ; Termina de enviar datos.
   movlw   0x01         ; Segundos inician en 00
   movwf   Segundo         ;
   movlw   0x02         ; Minutos inician en 05
   movwf   Minuto         ;
   clrf   Hora         ; Hora inicia en 00
   movlw   0x03         ; Dia 6 equivale a jueves
   movwf    DiaSemana
   movlw   0x20         ; Dia 26
   movwf    Dia
   movlw   0x08         ; Mes 02 equivale a agost
   movwf    Mes
   movlw   0x07         ; Año 2007
   movwf   Año   
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;--------------------SUBRUTINA DE ESCRITURA DEL DISPOSITIVO----------------------------;
escribir   
      call   bstart      ; Envía condicion de Inicio
      movlw   b'11010000'      ; Dirección de DS1307 (Escritura)
      call   escrib 
      movlw   0x00         ; a los segundos.
      call   escrib
      movf   Segundo,W   ; Pasa los segundos de la memoria del PIC16F84A al  DS1307.
      call   escrib         
      movf   Minuto,W      ; Y se repite el proceso para el resto.
      call   escrib
      movf   Hora,W
      call   escrib
      movf   DiaSemana,W
      call   escrib
      movf   Dia,W
      call   escrib
      movf   Mes,W
      call   escrib
      movf   Año,W
      call   escrib
      call   bstop   ; Termina de enviar datos.
      call   retardo            
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ACA PONGO UN LED EN PTOB,7 PARA SABER SI CORRE EL PROGRAMA
leo_rtc      bsf   ptob,7
      call   retardo   
      call   bstart      ; Envía condicion de Inicio
      movlw   b'11010000'      ; Dirección de DS1307  (Escritura)
      call   escrib      
      movlw   0x00         ; a los segundos.
      call   escrib
      call   bstop
      call   bstart         ; Envía condicion de Inicio
      movlw   b'11010001'         ; Dirección de DS1307  (Lectura)
      call   escrib         
      call   leer         ; Lee los segundos.
      movf   rxbuff,w      ; Lo carga en el registro correspondiente.
      movwf   Segundo      ; Lee el resto de los registros utilizando
               ; el mismo procedimiento.
      call   leer
      movf   rxbuff,w
      movwf   Minuto
      call   leer
      movf   rxbuff,w
      movwf   Hora
      call   leer
      movf   rxbuff,w
      movwf   DiaSemana
      call   leer
      movf   rxbuff,w
      movwf   Dia
      call   leer
      movf   rxbuff,w
      movwf   Mes
      call   leer
      movf   rxbuff,w
      movwf   Año
      call   bstop   ; Termina de leer datos.
   movlw   .76   ;l
   call   transmito
   movlw   .69   ;e
   call   transmito
   movlw   .79     ;o
   call   transmito
   movlw   .32
   call   transmito   
   movlw   .32
   call   transmito
   movlw   .13
   call   transmito
   movlw   .10
   call   transmito   
      call   retardo
      call   retardo
      bcf   ptob,7
      movf   DiaSemana,w
      movwf   mkm1
      call   decimal
      addlw   .48
      call   transmito
      call   retardo                        
      movf   Dia,w
      movwf   mkm1
      call   decimal
      addlw   .48
      call   transmito
      call   retardo
      movf   Mes,w
      movwf   mkm1
      call   decimal
      addlw   .48
      call   transmito
      call   retardo      
      movf   Año,w
      movwf   mkm1
      call   decimal
      addlw   .48
      call   transmito
      call   retardo
      movf   Hora,w
      movwf   mkm1
      call   decimal
      addlw   .48
      call   transmito
      call   retardo
      movf   Minuto,w
      movwf   mkm1
      call   decimal
      addlw   .48
      call   transmito
      call   retardo      
xxsal      movf   Segundo,w
      movwf   mkm1
      call   decimal
      addlw   .48
      call   transmito
      goto   leo_rtc            
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; RUTINA QUE CONVIERTE BINARIO EN "BCD"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
decimal
   clrf   mkm2
   clrf   mkm3
   movlw   .100
otra   subwf   mkm1,1    ;resta 100 al valor inicial
   btfss   status,0    ;verifica el carry
   goto   sum         ;si es cero deja de restar 100
   incf   mkm3,1       ;si es 1 incr centena
   goto   otra        ;volver a restar
sum   addwf   mkm1,1       ;sumarle 100
   movlw   .10
repite   subwf   mkm1,1      ;restar 10 al valor 
   btfss   status,0    ;verifica el carry
   goto   sum1       ;si es cero deja de restar
   incf   mkm2,1      ;si es 1 incr decena
   goto   repite
sum1   addwf   mkm1,1      ;sumarle 10 al valor
   retlw   0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;         
;--------------------------------------------------------------------------------------;
;;;;;;RUTINA PARA ENVIAR DATOS VIA RS232;;;;;;;;;;;;;;;;;;;;;;;;;
;;LA PC RECIBE A 1200 BAUDIOS 8 BITS 1 ARRANQUE Y 1 STOP;;;;;;;;;
transmito      
   movwf   trans
   movlw   .8       
   movwf   r1a      ;contador de 8 bit a transmitir
   bcf   ptob,2
   call   delay1
xnext
   bcf   ptob,2
   bcf   status,0
   rrf   trans
   btfsc   status,0
   bsf   ptob,2
   call   delay1
   decfsz   r1a
   goto   xnext
   bsf   ptob,2
   call   delay1
   retlw   0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;ESTA RUTINA LA USARIA CON EL PIC 16F628;;;;;;;;;;;
;------------------------------------------------------------------------------------------------------------------------------------------
;transmito   
;   movwf    txreg            ; send data in W 
;   bsf    status,5       ; RAM PAGE 1 
;   bcf   status,6
;espe   btfss    txsta,1       ; (1) transmission is complete if hi 
;         goto    espe
;         bcf    status,5          ; RAM PAGE 0 
;   bcf   status,6
;   bcf   pir1,4
;   call   retardo
;   bsf   intcon,7
;         retfie
;;;;;;;;;;;;;;;;;;;;;;;;
   end
titopereyra@yahoo.com