timer & serout on 28X2

BeanieBots

Moderator
PE V5.2.4
28X2 VB.0

I have this mimimalised program:-
Code:
#PICAXE 28X2
#no_data
#no_table
#slot 0

hintsetup %01110111 ‘ enable all 3 pins (trigger when pushed)
setintflags not %00000000, %10001000 'interrupt if on buttons OR timer

settimer t1s_8
timer=65535

do
serout b.3,T2400,("data")
loop


'**********************************************************
Interrupt:
	pulsout B.4,100

	flag3=0
	flag7=0
	
	timer=65535
	setintflags not %00000000,%10001000
	
Return
Functionally, it works as desired except the interrupt is called noticeably less than once a second. Around ten times in 12 seconds.

If I remove the 'serout' line, the interrupt is called very close to every second.

The manual clearly states that servo, degug and timer cannot be used together but it does not mention serout.

Is serout expected to interfere with 'timer'?
 

Technical

Technical Support
Staff member
Please see appendix 2 "Possible Conflicting Commands" at the end of manual part 2.

Any serial command, e.g. serout, will temporarily disable internal interrupt driven events like timer. If it didn't the serial data transmission would become corrupt. You could try hserout instead, as this uses a separate internal PIC hardware feature to transmit.
 
Last edited:
Top