PDA

View Full Version : Problem with -ASM



Megahertz
- 8th May 2011, 10:48
I am trying to test one IR to RF code found on rentron, I am trying to adjust it for 16F877A. Can someone please help me correct this code: (Rest of my code will be in PBP)

ASM
Hold ; generate 40kHz carrier when GPIO.0 = 1
bcf PortD,2 ; LED = off
btfss PortD,0 ; Is data input at logic 1..?
goto $-1 ; No, then keep waiting
Freq1
bsf PortD,2 ; Yes, so begin 40kHz IR carrier generation
btfss PortD,0 ; 2uS
goto Hold ; 3uS
btfss PortD,0 ; 4uS
goto Hold ; 5uS
btfss PortD,0 ; 6uS
goto Hold ; 7uS
btfss PortD,0 ; 8uS
goto Hold ; 9uS
btfss PortD,0 ; 10uS
goto Hold ; 11uS
btfss PortD,0 ; 12uS
goto Hold ; 13uS (~52% duty-cycle)
bcf PortD,2 ; 14uS turn off IR LED here
btfss PortD,0 ; 15uS
goto Hold ; 16uS
btfss PortD,0 ; 17uS
goto Hold ; 18uS
btfss PortD,0 ; 19uS
goto Hold ; 20uS
btfss PortD,0 ; 21uS
goto Hold ; 22uS
btfsc PortD,0 ; 23uS If PortD,0 = 0 end carrier, else continue
goto Freq1 ; 25uS, GOTO requires 2uS, 25uS total=40kHz
goto Hold ; return & wait
ENDASM

END
Where there was GPIO I changed it to PortD, I know it seems wrong, but please excuse my ignorance towards Assembly.
My IR LED is attached to PortD.2 & My RF data in is at PortD.0
When I compile this the error which comes is: "\D_DRIVE\IR_TO_RF\IR_2_RF.ASM 231 : Symbol not previously defined (PortD)" x 15 times

Kamikaze47
- 8th May 2011, 16:29
Try using PORTD instead of PortD