
Originally Posted by
tazntex
keydata var b3
What is 'b3' supposed to be?
Your logic is messed up...
Code:
INCLUDE "bs2defs.bas"
keydata VAR b3 <----- what is this again?
serpin VAR porta.4
trisa = %00010000 : trisb = %00000000
loop:
gosub loop1
goto keyed <------Why GOTO the next line below?
Let the program go to it, after all, it's right there
keyed:
IF keydata = 1 THEN outr1........IF keydata = 12 THEN outr12
and again, from the last thread you posted this in, it's fairly
bad form using all these IF/THEN statements,
look at using BRANCH in the manual instead
.....................
loop1:
SERIN serpin,N2400,[254],keydata
IF keydata => 1 AND keydata <= 12 THEN GOTO keyed
You GOSUB'd into this loop1: but you GOTO to get out of it if need be.
You can't do that, at least not for very long, depending on the program.
That's a stack overflow waiting to happen which leads to a PIC reset,
or at least a big mess.
return
Bookmarks