- Joined Oct 25, 2019
i bought some new pic 12f508 chips for a project and found that i could not output on pin 2 , i have looked on various forums and tried all the answers i could find but none worked , i have included the program so you can see what i have and tell me where i went wrong please .
Moderators note : used code tags
; GP2 Test program list p=112f508 #include p12f508.inc __CONFIG 0X0FEA ; ORG 0 MOVWF OSCCAL OPTION 0XDF ;11011111 ;Note: If the T0CS bit is set to ‘1’, it will override ;the TRIS function on the T0CKI pin. ;bit 5 T0CS: Timer0 Clock Source Select bit ;1 = Transition on T0CKI pin (overrides TRIS on the T0CKI pin) ;0 = Transition on internal instruction cycle clock, FOSC/4 ;5.3 TRIS Registers ;The Output Driver Control register is loaded with the ;contents of the W register by executing the TRIS f ;instruction. A ‘1’ from a TRIS register bit puts the corresponding ;output driver in a High-Impedance mode. A ;‘0’ puts the contents of the output data latch on the ;selected pins, enabling the output buffer. The exceptions ;are RB3/GP3, which is input only and the T0CKI ;pin, which may be controlled by the OPTION register. ;See Register 4-3 and Register 4-4. SETUP MOVLW 0XC0 ;set all 6 bits as output even 3 in only pin TRIS GPIO CLRF GPIO MOVLW 0X00 MOVWF 0X18 NEXT MOVF 0X18,W INCF 0X18,F MOVWF GPIO ; BSF GPIO,2 ;to try direct control of port bit CALL DELAY ; BCF GPIO,2 ;to try direct control of port bit GOTO NEXT DELAY MOVLW 0X01 ;LONG TIME COUNT (7) MOVWF 0X15 T0 MOVLW 0X80 ;MED TIME COUNT (00) MOVWF 0X16 T1 MOVLW 0X00 ;SHORT TIME COUNT (00) MOVWF 0X17 T2 DECFSZ 0X17,F GOTO T2 DECFSZ 0X16,F GOTO T1 DECFSZ 0X15,F GOTO T0 RETLW 0 END
Last edited by a moderator: