Hi guys. Thanks to all that bother reading my question.
After huge amount of work i wrote the following program (4MHz pic16f876a).Although i can see MessageA and MessageB (when portb.7 is 5volts), and
HSerout [DEC B0,",",DEC B1,",",DEC B2,13,10] the problem is always tha the latter seems to stop the microcontroller. Although i can see HSerout [DEC B0,",",DEC B1,",",DEC B2,13,10] for a couple of times about in the 4th giving of data i take no response from microcontroller.With a reset everything is fine until another 3-4 giving of data.Has anything to do with overrun buffers? but i have included DEFINE HSER_CLOERR 1 ' automatic clear overrun error . Thanks anyway.....



INCLUDE "MODEDEFS.BAS"
DEFINE OSC 4

B0 VAR WORD
B1 VAR WORD
B2 VAR WORD
B3 VAR WORD
B4 VAR WORD

TRISC = %10000000 ' PORTC.7 is the RX input
' PORTC.6 is the TX output
' Serial communication definition
' ===============================
' Using internal USART and MAX232 to interface to PC
'
DEFINE HSER_RCSTA 90h ' enable serial port,
' enable continuous receive

DEFINE HSER_TXSTA 24h ' enable transmit,
' BRGH=1

DEFINE HSER_BAUD 9600
DEFINE HSER_CLOERR 1 ' automatic clear overrun error


RCIF VAR PIR1.5 ' Receive interrupt flag (1=full , 0=empty)
TXIF VAR PIR1.4 ' Transmit interrupt flag (1=empty, 0=full)

Pause 10 ' safe start-up delay
B0=0 '(duty cycle pwm)

HSerout ["Hi"]
main:

IF PORTB.7=1 Then
GoSub MessageA
EndIF

HSerout ["MessageB",13,10]
HPwm 1,B0,1000
High PORTB.5
Pause 1000
Low PORTB.5
Pause 1000
IF (RCIF) AND (PORTB.7=0) Then ' incomming data?
HSerin [WAIT ("d"),DEC B0,DEC B1,DEC B2]
HSerout [DEC B0,",",DEC B1,",",DEC B2,13,10] ' send it
EndIF
GoTo main

GoTo main
MessageA:
HSerout ["MessageA",13,10]
HSerout ["MessageA",13,10]
HSerout ["MessageA",13,10]
Pause 1000
HPwm 1,127,1000
GoTo main
End