vterminater
New Member
what i have to do is generate 3 pulses 1)on 2)off 3)on the time for each pulse is given by the user(i have to give those values using labview;will do that once this is done)This is what i tried using pic18f4550 with external clock 20Mhz...when i checked output through simulator the code keeps executing here:goto here...so even the first delay does not end...any help???
#include<p18f4550.inc>
CONFIG WDT= OFF; disable watchdog timer
CONFIG MCLRE = ON; MCLEAR Pin on
CONFIG DEBUG = ON; Enable Debug Mode
CONFIG LVP = OFF; Low-Voltage programming disabled (necessary for debugging)
CONFIG FOSC = HS
;for external clocK
Td1 equ 0x00
Td2 equ 0x01
Td3 equ 0x02
Td equ 0x03
org 0
goto start
org 0x20
start:clrf TRISD
movlw 0x32
movwf Td1
movlw 0x64
movwf Td2
movlw 0xc8
movwf Td3
movlw 0xff
movwf PORTD
movlw b'10111000'
movwf T0CON
movff Td1,Td
call delay
movlw 0x00
movwf PORTD
movff Td2,Td
call delay
movlw 0xff
movwf PORTD
movff Td3,Td
movlw 0x00
movwf PORTD
org 0x60
delay:movlw 0x05
mullw Td
movff PRODL,TMR0L
movff PRODH,TMR0H
bcf INTCON,TMR0IF
here:goto here
return
end
#include<p18f4550.inc>
CONFIG WDT= OFF; disable watchdog timer
CONFIG MCLRE = ON; MCLEAR Pin on
CONFIG DEBUG = ON; Enable Debug Mode
CONFIG LVP = OFF; Low-Voltage programming disabled (necessary for debugging)
CONFIG FOSC = HS
;for external clocK
Td1 equ 0x00
Td2 equ 0x01
Td3 equ 0x02
Td equ 0x03
org 0
goto start
org 0x20
start:clrf TRISD
movlw 0x32
movwf Td1
movlw 0x64
movwf Td2
movlw 0xc8
movwf Td3
movlw 0xff
movwf PORTD
movlw b'10111000'
movwf T0CON
movff Td1,Td
call delay
movlw 0x00
movwf PORTD
movff Td2,Td
call delay
movlw 0xff
movwf PORTD
movff Td3,Td
movlw 0x00
movwf PORTD
org 0x60
delay:movlw 0x05
mullw Td
movff PRODL,TMR0L
movff PRODH,TMR0H
bcf INTCON,TMR0IF
here:goto here
return
end
Last edited: