M
max0412
Guest
Dit is waarschijnlijk Grappig eenvoudig, maar ik ben net beginnen met PIC's.Dus wees soort.
Is het mogelijk om een 1.25kHz 50% duty cycle golf uit een PIC12F508 genereren.Ik kom heel voorbeelden waar zij gebruik maken van een NOP voor 1uS intervallen hier.
Code
ROCESSOR 12F508
# include "p12f508.inc"
__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _XT_OSC
# Define PORT B'11111101 '
MOVF OSCCAL
MOVLW PORT
TRIS GPIOBEGIN
BCF GPIO, 1; 1uS
NOP; 2US elke NOP is 1uS lang
NOP; 3uS
NOP; 4US
NOP; 5uS
NOP; 6uS
NOP; 7uS
NOP; 8uS
NOP; 9Us
NOP; 10US
NOP; 11uS
NOP; 12US
NOP; 13uS
NOP; 14uS
NOP; 15uS
NOP; 16uS
NOP; 17uS
NOP; 18uS
NOP; 19uS
BSF GPIO, 1; 1uS Begin HOGE duty cycle
NOP; 2US
NOP; 3uS
NOP; 4US
NOP; 5uS
GOTO BEGIN; 2US (26uS totaal voor 38kHz)
END
Is het mogelijk om een 1.25kHz 50% duty cycle golf uit een PIC12F508 genereren.Ik kom heel voorbeelden waar zij gebruik maken van een NOP voor 1uS intervallen hier.
Code
# include "p12f508.inc"
__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _XT_OSC
# Define PORT B'11111101 '
MOVF OSCCAL
MOVLW PORT
TRIS GPIOBEGIN
BCF GPIO, 1; 1uS
NOP; 2US elke NOP is 1uS lang
NOP; 3uS
NOP; 4US
NOP; 5uS
NOP; 6uS
NOP; 7uS
NOP; 8uS
NOP; 9Us
NOP; 10US
NOP; 11uS
NOP; 12US
NOP; 13uS
NOP; 14uS
NOP; 15uS
NOP; 16uS
NOP; 17uS
NOP; 18uS
NOP; 19uS
BSF GPIO, 1; 1uS Begin HOGE duty cycle
NOP; 2US
NOP; 3uS
NOP; 4US
NOP; 5uS
GOTO BEGIN; 2US (26uS totaal voor 38kHz)
END