'{$STAMP BS2} '{$PBASIC 2.5} ' 2008 mlab.taik.fi/paja ' Sending data to a Serial port ' ---[ I/O Definitions ]--- pPot PIN 10 pSerial CON 16 'Pin 16 is serial port that is connected to your PC. ' ---[ Variables ]--- wResult VAR WORD ' ---[ Initialization ]--- DEBUG CLS, "Sending data to a Serial port", CR ' ---[ Main Code ]--- Main: DO HIGH pPot ' charge the capacitor PAUSE 1 ' for 1 ms RCTIME pPot, 1, wResult ' measure RC discharge time ' DEBUG baudrate is 84 9600 baudrate, 8bit, no-parity, 1 Stop bits ' SEROUT Tpin{\Fpin}, Baudmode, {Pace, } {Timeout, Tlabel, } [OutputData] ' Tpin: pin number (0-16). Pin16 is dedicated serial-output pin ' TO RS232 OR USB. ' Fpin: optional pin number (0-15). Specifies the I/O pin to monitor for flow ' control status. ' Baudmode: 0-65535. specifies serial timing and configuration. ' See SEROUT in BASIC Stamp Synbtax and Reference Manual ' Pace: Optional (0-65535). Determines the length of the pause ' with Timeout AND Fpin. ' Timeout: Optional (0-65535). Tells SEROUT how long to wait for Fpin ' permission TO send. ' Tlabl: Optional label. Must be provided along with Timeout. Indicats ' where the program should go after timeout. ' OutputData: Tells SEROUT how to format outgoing data. ' See SEROUT in BASIC Stamp Synbtax and Reference Manual SEROUT pSerial, 84, [DEC wResult/255, CR] '== DEBUG DEC wResult/255, CR ' 84 : 9600 baudrate, Nonparity, 8Bits, 1 stopbits PAUSE 100 LOOP END