PDA

View Full Version : help for 12C508A



dagger
- 4th August 2010, 23:28
I am using a web-translator.... I need help to modify a program carried out on a PIC 12C508A.
This PIC has 2 imputs and 1 exit
When in the 2 imputs have a state "H",(at least one second)...,the output turn high state during 2 minutes.
Then it returns to low state and it is awaiting that has been again high in the 2 imputs simultaneously.
I would need that the entrances are GP5 and GP4
The exit GP2
Internal oscillator .....I don't need precision in the time
I attach them the program that uiso at the moment and that it is necessary to modify
Thank you

#include <P12C508A.INC>

;__config 03f18h

;Declaración de variables.
RetardoA equ 07h
RetardoB equ 08h
RetardoC equ 09h

;Vector de reset
org 00h
goto Inicio ;Ir a configurar los puertos.

Delay35S
movlw .200
movwf RetardoA
movlw .250
movwf RetardoB
movlw .250
movwf RetardoC
decfsz RetardoC,F
goto $-1
decfsz RetardoB,F
goto $-5
decfsz RetardoA,F
goto $-9
retlw 0

; Delay = 60 seconds
; Clock frequency = 4 MHz
; Actual delay = 60 seconds = 60000000 cycles
; Error = 0 %
; 59999994 cycles

Delay60s
movlw 0x23
movwf RetardoA
movlw 0xCB
movwf RetardoB
movlw 0x83
movwf RetardoC
Delay_0
decfsz RetardoA, f
goto $+2
decfsz RetardoB, f
goto $+2
decfsz RetardoC, f
goto Delay_0

;6 cycles
goto $+1
goto $+1
goto $+1

Inicio
;Configurar los puertos
movlw b'00000011' ;GP0 y GP1 son entradas, el resto salidas.
tris GPIO
movlw b'11011111' ;T0CS-Timer0 se incrementa con cada ciclo interno, sino vuelve a GP2 una entrada
option

bcf GPIO,2 ;Apagar la salida GP2.
Leer
btfss GPIO,0 ;Entrada GP0 = 1 ?
goto Leer ;No, volver a leer.
btfss GPIO,1 ;Si, Entrada GP1 = 1 ?
goto Leer ;No, volver a leer.

bsf GPIO, 2 ;Si, activar la salida.
call Delay60s ;Retardo de 60 segundos.
call Delay60s ;Retardo de 60 segundos.
bcf GPIO, 2 ;Apagar la salida.
goto Leer ;Volver a leer las entradas.

end

dagger
- 18th August 2010, 19:55
??? can nobody help me???

ScaleRobotics
- 18th August 2010, 20:29
Hello dagger, and welcome to the Pic Basic compiler forum.

The forum here is made for folks that use PicBasicPro, a basic compiler. Most here don't feel as comfortable programming in assembly. Yes, there are some here that are pretty comfortable with assembly, but the majority are not.

I am sure if you re-write it in PicBasic Pro, you will get a lot more help here. Maybe someone will still answer your original question, but probably less likely here than at the microchip forum.

Good luck.

Walter

dagger
- 30th August 2010, 23:25
tx walter for your time