hi everyone...
I've writen a PB program to controll a pulse motor...
It compiles without any errors or warnings...
It runs in the oshon soft pic simulation IDE with out a problem

As soon as i try to run it in a PIC random ports become high but don't change...
I have a test program that runs fine and that uses the same serout2 command and it sends data to my PC without a problem...

I'm guessing i missed something that i should have setup... can someone take a look and tell me what i missed?
I've got no idea on where to begin to diagnose this type of problem...

Code:
include "bs1defs.bas"
Define  CONF_WORD = 	0x3F3A
Define  OSC				20				' Set clock speed

Define  ADC_BITS        10     			' Set number of bits in result
Define  ADC_SAMPLEUS    10    			' Set sampling time in uS

ADCON0.7 = 0							' ADC clock set to Fosc/2
ADCON0.6 = 0							' ADC clock set to Fosc/2
ADCON1.6 = 0							' ADC clock set to Fosc/2

INTCON = 0								' Disable all interupts
'DEFINE  SER2_BITS		8				' Ser2 number of data bits
'RCSTA = %10010000						' Enable serial port and continuous receive
'TXSTA = %00100100						' Enable transmit and asynchronous mode with BRGH 1
'SPBRG = 20								' Set baud rate to 57600 with 20mhz clock (BRGH = 1)

ADT1 var word							' Create ADT1 to store curent ad conversion for AD channel 0
ADT1MAX var word						' Create ADT1MAX to store curent ADC0 max val
ADT1MAX = 0
ADT1VAL var word
ADT1VAL = 0
ADV1 var word
VOLT1H var word
VOLT1L var word
C1N	var bit
C1N = 0
C1S	var bit
C1S = 0
PCOUNTER var byte
PCOUNTER = 0
PTICK var bit
PTICK = 0
RPM var word
RPM = 0
TMR1_VAL var word
TMR1_VAL = 0

TRISE = 255							' Set PortE to all inputs
TRISD = 0							' Set PortD to all outputs
TRISC = 0							' Set PortC to all outputs
TRISB = 0							' Set PortB to all outputs
TRISA = 255 						' Set PORTA to all input
ADCON1 = 0 							' PORTA is analog

PIE1.0 = 0							' Disable TMR1 interupt (double check)
T1CON.5 = 1 						' Setup TMR1 timings
T1CON.4 = 1
T1CON.3 = 1
T1CON.1 = 0
T1CON.0 = 1

main:
gosub getadc
gosub control
gosub backemfreuse
gosub rpmcounter
gosub adcvonvert
gosub telemetry
goto main

getadc:
ADCIN 0, ADT1
return

adcvonvert:
ADT1 = ADT1 / 64
VOLT1H = ((48 * ADT1) / 10000)
VOLT1L = ((48 * ADT1) - (((48 * ADT1) / 10000) * 10000)) / 100
return

rpmcounter:
if PCOUNTER = 4 then
	T1CON.0 = 0 					' Pause TMR1
	TMR1_VAL.lowbyte = TMR1L		' Load TMR1 Low end byte
	TMR1_VAL.Highbyte = TMR1H		' Load TMR1 High end byte
	RPM = 60000 / ((TMR1_VAL * 16)/10000)
	PCOUNTER = 0
	TMR1L = 0
	TMR1H = 0
	T1CON.0 = 1
	endif
return

telemetry:
'HSEROUT ["V1:",DEC5 VOLT1H,".",DEC5 VOLT1L," RPM:", DEC5 RPM,10]

SEROUT2 PORTD.0,16468,["V1:",DEC VOLT1H,".",DEC VOLT1L," RPM:",DEC RPM,10]
RETURN

control:
'IF ADT1 > 200 and ADT2 > 200 then
'	LOW PORTB.0
'	LOW PORTB.1
'	C1N = 0
'	C1S = 0
'	return
'	ENDIF
IF ADT1 > 200 then
	high PORTB.0
	LOW PORTD.7
	C1N = 1
	IF PTICK = 0 then
		PCOUNTER = PCOUNTER + 1
		PTICK = 1
		endif
	endif
IF ADT1 < 200 then
	LOW PORTB.0
	C1N = 0
	IF PTICK = 1 then
		PTICK = 0
		endif
	endif
return

backemfreuse:
if C1N = 0 then 'and C1S = 0 
	High PORTD.7
Else
	LOW PORTD.7
endif
return

end
Thank you