'****************************************** ' messy double-handshake routine ' for serout to PIC 16F84A ' ' stamp sends a high to start ' handshake and then waits for return ' low from PIC before transmission. ' PIC output is tested and ' results are posted to backpack LCD. ' ' benz y2k '****************************************** 'define variables cnt var byte 'count to be sent to PIC err0 var word 'errors? x var byte 'scratch byte for loops y var word 'scratch word for loops pp var byte 'pause 'define constants picpin con 1 'PIC serout pin pichs con 2 'PIC-generated handshake pin stamphs con 3 'stamp-generated handshake pin n2400 con $418D 'LCD backpack baud ezee2 con 84 'PIC baud 9600, 8 bits, no parity, noninverted 'define pin I/O dirs = %0000000000001011 'pins 1,2 & 3 are outputs 'set initial values of variables & pins err0 = 0 y = 0 pp = 80 low stamphs start: for x = 1 to 255 'outer loop for cnt = 0 to 255 'data for PIC high stamphs 'send a HEYHEY got data for you serout picpin\pichs,ezee2,[cnt] 'send it low stamphs 'we're done if cnt = inh then ok0 'check for errors err0 = err0 + 1 'if found then count it ok0: 'else pause pp 'wait a sec? pause pp serout 0,n2400,[12,dec y, " ",dec x," ",dec err0] 'transmit to LCD too next pp = pp - 10 'decrement pause next y = y + 1 'increment word loop goto start end