Perhaps this will be to your liking.
/Ingvar
@ device pic16F876, hs_osc
DEFINE OSC 20
TxPin VAR PortA.0
RxPin VAR PortA.1
PulsPin VAR PortA.2
HiWord VAR WORD
LoWord VAR WORD
Dummy1 VAR WORD
Dummy2 VAR WORD
Dummy VAR BYTE
ADCON1 = 7
TrisA = %11111010
WHILE 1
SEROUT2 TxPin,84,["Enter number of pulses(9 digits)!",13,10]
'Recieve Hi and Low part of pulsnumber
'Number must always be transmitted as 9 digits(leading zeroes) and
'not greater than 655359999.
SERIN2 RxPin,84,[DEC5 HiWord]
SERIN2 RxPin,84,[DEC4 LoWord]
'Debuginfo
SEROUT2 TxPin,84,["Sending ",DEC5 HiWord, DEC4 LoWord, " pulses.",13,10]
'Send the pulses
For Dummy1 = 1 to HiWord
For Dummy2 = 0 to 9999
PulsPin = 1
PulsPin = 0
NEXT
NEXT
For Dummy1 = 1 to LoWord
PulsPin = 1
PulsPin = 0
NEXT
WEND
END
Bookmarks