Quote Originally Posted by shawn View Post
Number = 0
WHILE Number < 3
TXREG = Data[Number]
Number = Number + 1
WEND

''''''''''''''or'''''''''''''''''''

HSEROUT [Data[0],Data[1],Data[2]]
The first example would execute much quicker.
Unfortunately, it does so by not sending all 4 bytes like you might anticipate.

When putting bytes in TXREG, you have to make sure that the USART is finished sending the last byte you put in it.

Typically, you would check the TXIF bit to make sure it's safe to send, which the first example doesn't do, and the HSEROUT does automatically.


Next question, which is faster.

Number = 0
While Number < 3
'Code in here converst all three array variables so that they will be display properly
'whereas the HSEROUT statement bellow does it for you.
wend

Number = 0
WHILE Number < 3
TXREG = Data[Number]
Number = Number + 1
WEND

''''''''''''or''''''''''''''

HSEROUT [Hex2 Data[0],Hex2 Data[1],Hex2 Data[2]]
Most likely, the HSEROUT will be faster.
But there's no way of knowing, without the actual ..."Code in here converst all three array variables so that they will be display".

Final question, could someone give an example of when or why you would need to poll the TXIF: USART Transmit Interrupt Flag bit.
Because of the first answer.

hth,