‘ Is RWM safe!
flipflop var byte
flipflop = %01010101
cycle:
portb = flipflop
@comf _flipflop
goto cycle
doing it that way won't get past a few hundred kilohertz
its easy with the dsp module ,but the last pulse is difficult to control
if being 1 pulsE short sometimes this works great for a 4MHz output stream
Code:
'****************************************************************
'* Name : MODULATOR.BAS *
'* Author : richard *
'* Notice : Copyright (c) 2016 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 5/29/2016 *
'* Version : 1.0 *
'* Notes : 4MHZ CARRIER FOR X PULSES x=10 to 65535 *
'* : 16F1825 *
'****************************************************************
#CONFIG
__config _CONFIG1, _FOSC_INTOSC & _CP_OFF & _WDTE_ON & _PWRTE_ON & _MCLRE_ON & _CLKOUTEN_OFF
__config _CONFIG2, _PLLEN_ON & _LVP_OFF
#ENDCONFIG
OSCCON=$70
DEFINE OSC 32
@TIMER1=TMR1L
' PIC 16F1825
TRISA = %111111 ' Make all pins Input
trisc = %101111 ;Make all pins Input
ANSELA=0
ANSELC=0
CLKRCON= %11110011
MDCON= %11000000
MDSRC= %00000000
MDCARH =%00100011
MDCARL =%00000000
X VAR WORD
TIMER1 VAR WORD EXT
' ;debug --------------------------
' TRISA.0 = 0
' lata.0=1
' pause 2000 ;debug
' serout2 PORTa.0,84, ["ready v3",13,10 ] ;debug
' ;debug ------------------------------------
; moddout is portc.4
X=40
Main_Loop:
TIMER1=~(X-6)
ASM
BCF PIR1,0
MOVE?CT 1,MDCON,0
MOVE?CB 0X71,T1CON
COFF
BTFSS PIR1,0 ;
BRA COFF
MOVE?CT 0,MDCON,0
MOVE?CT 0,T1CON,0
ENDASM
PAUSE 200
goto Main_Loop
end
Bookmarks