Im sure its worked for me in the past too. I had already tried word.byte0/1 but i tried high/lowbyte too and still no luck. The problem i have is that the byte always seems to be less than the word. I just checked it with a status light on and aparently the byte is always 0 because no serial data arrives. The word doesnt have anything to do with serial so ive no idea whats happening there :S
Ill see if i can figure it out. I know its not the compare code now
Ive found where the problem is. I commented all the relative code out then turned it back on 1 line at a time until it broke again.
At the top i have this code
In the interrupt handler for TMR0 i have this codeCode:cServoOffTime con 255 pServo1 var PORTA.3 vServo1Pos var WORD
If i comment out the if statement (not the code in it, just if-then and endif) or i change vServo1Pos to a byte then it works fine. As it is above it stops any serial data from being received. I dont get how that could possibly affect itCode:if vservo1pos>=cservoofftime then pServo1=1 vservo1pos=0 endif
Don't know if it'll make ANY difference at all but...
Code:if vservo1pos => cservoofftime then pServo1=1 vservo1pos=0 endif
Unfortunately not, I already tried that because some languages like PHP dont like it if you put them in the wrong order. PBP doesnt seem to mind though.
Ive been testing a different line of code that does almost the same thing
When i use that code i can send serial data fine for about 5 seconds then it stops. It looks similar to a problem i had the other day but that was because i wasnt resetting a variable back to 0 when i should have. This code shouldnt affect that variable at all though. The PIC doesnt stop running because it still generates the pulseCode:if vservo1pos=>vservo1+12 then
If vservo1 ends up being greater than 65,524, then vservo1 + 12 = 65536, which in a WORD variable ends up equalling ZERO...Code:if vservo1pos=>vservo1+12 then
vServo1 is a byte and cant go above 255.
I will try declaring cServoOffTime as a variable instead. I think something similar to this was the reason for my thread about the datatypes of constants
What happens if you do this:
Code:cServoOffTime var WORD cServoOffTime = 255 pServo1 var PORTA.3 vServo1Pos var WORD ............................................................ if vservo1pos>=cservoofftime then pServo1=1 vservo1pos=0 endif
Bookmarks