16F877's PWM to output 38KHZ data to transmit?


infrared---currently i'm using pic16f877 create pulsing(eg : 10101010) receive keypad ir transmitter transmitted. wish use feature pic16f877 pwm create carrier frequency 38khz combine pulsing(10101010)  to send signal ir transmiter ir receiver 38khz. attachment below simple coding send data(10101010) without using pwm output. can me amend coding in order output pin pwm in pic16f877 create 38khz carrier frequency please!!!!!!!!!!!!!

list p=16f877,f=inhx32, x=off
include <p16f877.inc>



     __config _cp_off & _pwrte_on & _xt_osc & _wdt_off

     errorlevel -302 ;suppress bank warning



tmro            equ      1
status            equ      3
porta            equ      5
portb            equ      6
trisa            equ      85h
trisb            equ      86h
option_r      equ      81h
zerobit            equ      2
count            equ      h'0c'
temp            equ      h'0d'

;----------------------------------


                 org            0x00
                 goto      start

;subroutine section----------------

;2.5ms second delay
delay1      clrf      tmr0
loopa      movf      tmr0,w
           sublw      .1
           btfss      status,zerobit
           goto      loopa
           retlw      0
     
;5ms second delay------------------
delay2      clrf      tmr0
loopb      movf      tmr0,w
           sublw      .3
           btfss      status,zerobit
           goto      loopb
           retlw      0

;7.5ms second delay-----------------
delay3      clrf      tmr0
loopc      movf      tmr0,w
           sublw      .6
           btfss      status,zerobit
           goto      loopc
           retlw      0

;configuration section--------------

start      bsf      status,5
           movlw      b'00011110'
           movwf      trisa
           movlw      b'00000000'
           movwf      trisb
           clrf      trisc
           movlw      b'00000010'
           movwf      option_r

           bcf      status,5
           clrf      porta
           clrf      portb
;program starts now-----------------

begin      btfsc      porta,0
           goto      begin
           movlw      b'10101010'
           movwf      temp
     
           bcf      portb,1
           call      delay1
           bsf      portb,1
           call      delay3

testa0      bcf      portb,1
           call      delay1
           btfsc      temp,0
           goto      seta0
           goto      clra0

seta0      bsf      portb,1
           call      delay2
           goto      testa1
     
clra0      bsf      portb,1
           call      delay1

testa1      bcf      portb,1
           call      delay1
           btfsc      temp,1
           goto      seta1
           goto      clra1

seta1      bsf      portb,1
           call      delay2
           goto      testa2
     
clra1      bsf      portb,1
           call      delay1

testa2      bcf      portb,1
           call      delay1
           btfsc      temp,2
           goto      seta2
           goto      clra2

seta2      bsf      portb,1
           call      delay2
           goto      testa3
     
clra2      bsf      portb,1
           call      delay1

testa3      bcf      portb,1
           call      delay1
           btfsc      temp,3
           goto      seta3
           goto      clra3

seta3      bsf      portb,1
           call      delay2
           goto      testa4
     
clra3      bsf      portb,1
           call      delay1

testa4      bcf      portb,1
           call      delay1
           btfsc      temp,4
           goto      seta4
           goto      clra4

seta4      bsf      portb,1
           call      delay2
           goto      testa5
     
clra4      bsf      portb,1
           call      delay1

testa5      bcf      portb,1
           call      delay1
           btfsc      temp,5
           goto      seta5
           goto      clra5

seta5      bsf      portb,1
           call      delay2
           goto      testa6
     
clra5      bsf      portb,1
           call      delay1

testa6      bcf      portb,1
           call      delay1
           btfsc      temp,6
           goto      seta6
           goto      clra6

seta6      bsf      portb,1
           call      delay2
           goto      testa7
     
clra6      bsf      portb,1
           call      delay1

testa7      bcf      portb,1
           call      delay1
           btfsc      temp,7
           goto      seta7
           goto      clra7

seta7      bsf      portb,1
           call      delay2
           clrf      portb
           goto      begin
     
clra7      bsf      portb,1
           call      delay1
           clrf      portb
           goto      begin
           end

is there can give me helping hand???

thxssssss


Arduino Forum > Forum 2005-2010 (read only) > Software > Interfacing > 16F877's PWM to output 38KHZ data to transmit?


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums