'---------------------------------------------------------------------------------------- ' Name: SER1_DEMO_EXOTIC_BAUDRATES.TIG ' Type: TIGER-BASIC(tm) Source Code ' Purpose: Demo for rather "exotic" baudrates of 31,250 baud ("MIDI") and 62,500 baud ' on internal serial channels with "SER1B_xxx.TDD" driver (from V1.02e). ' ' (C) - Copyright Wilke Technology, P.O.Box 1727, D-52018 Aachen, Germany '---------------------------------------------------------------------------------------- ' ' Thank you for using BASIC Tigers in your products. If you have questions, ideas ' or special needs, please contact your next distributor or the Tiger support team ' and visit our web site: ' ' Wilke Technology GmbH ' The Tiger Support Team ' P.O.Box 1727, D-52018 Aachen, Germany ' Krefelder Str. 147, D-52070 Aachen, Germany ' ' email: support@wilke-technology.com (english) ' email: support@wilke.de (german) ' Phone: +49 (241) 918 900 Mo to Fr, 7:00 to 16:00 (GMT) ' Fax: +49 (241) 918 9068 ' ' New information, new drivers and free downloads see: ' ' www.wilke-technology.com (english) ' www.wilke.de (german) ' ' Sincerely, ' ' Your Tiger Support Team ' '---------------------------------------------------------------------------------------- ' ' This demo is written for Plug & Play Lab or equivalent environment carrying a ' Tiger module of your choice. ' ' To run the demo, please make to following connections: ' ' * Connect TxD-0 with RxD-0 ' * Connect CTS-0 to S P A C E or RTS-0. ' ' ' In a loopback on serial channel-0 characters are sent and received at unusual ' baudrates. These are 31,250 baud ("MIDI" baudrate) or 62,500. ' '---------------------------------------------------------------------------------------- USER_VAR_STRICT ' check for var declaration #INCLUDE DEFINE_A.INC ' general symbol definitions '---------------------------------------------------------------------------------------- ' Task MAIN: Load drivers, initialize vars, start tasks '---------------------------------------------------------------------------------------- TASK MAIN ' begin task MAIN BYTE EVER ' for endless loop #INCLUDE DEFINE_I.INC ' general symbol definitions INSTALL_DEVICE #LCD, "LCD1.TDD" ' install LCD driver ' install SERIAL driver with standard baudrate: ' INSTALL_DEVICE #SER, "SER1B_K1.TDD", BD_38_400, DP_8N, JA, BD_38_400, DP_8E, JA ' <-----Ser-Ch-0-----> <-----Ser-Ch-1-----> ' install SERIAL driver with baud parameter "32" = MIDI baudrate: ' INSTALL_DEVICE #SER, "SER1B_K1.TDD", 32, DP_8N, JA, BD_38_400, DP_8E, JA ' <-----Ser-Ch-0-----> <-----Ser-Ch-1-----> ' install SERIAL driver with baud parameter "33" = 62,500 baud: INSTALL_DEVICE #SER, "SER1B_K1.TDD", 33, DP_8N, JA, BD_38_400, DP_8E, JA ' <-----Ser-Ch-0-----> <-----Ser-Ch-1-----> PRINT #LCD, "= Unusual baudrate ="; ' PRINT #LCD, "= on serial ch-0 =" ' RUN_TASK SER0_IN ' <-- read serial ch-0 to LCD RUN_TASK SER0_OUT ' <-- write on serial ch-0 FOR EVER = 0 TO 0 STEP 0 ' endless loop PRINT #LCD, "<27>A<0><2><240>"; TICKS() ' output s.th. on LCD WAIT_DURATION 500 ' wait 500 ms NEXT ' end of endless loop END ' end of task MAIN '---------------------------------------------------------------------------------------- ' Task: Reads from serial port 0 and shows characters on LCD '---------------------------------------------------------------------------------------- TASK SER0_IN ' begin task SER0_IN STRING A$(1K) ' receive string BYTE EVER ' for endless loop A$ = "------------------" ' preset receive string FOR EVER = 0 TO 0 STEP 0 ' endless loop PRINT #LCD, "<27>A<0><3><240><<"; A$; ">" ' output receive string WAIT_DURATION 100 ' wait 100 ms CALL APPEND (A$, 18, SER, 0) ' append chars from I/O channel 0 NEXT ' end of endless loop END ' '---------------------------------------------------------------------------------------- ' Task: Writes to serial port 0 '---------------------------------------------------------------------------------------- TASK SER0_OUT ' begin task SER0_OUT BYTE EVER, CH ' for loops FOR EVER = 0 TO 0 STEP 0 ' endless loop FOR CH = 32 TO 127 ' loop over printable chars PRINT #SER, #0, CHR$(CH); ' write character to ch-0 NEXT ' next character WAIT_DURATION 100 ' wait 100 ms NEXT ' end of endless loop END ' end of task SER0_OUT '---------------------------------------------------------------------------------------- ' Subroutine: Wait & get chars from I/O channel --> append to string '---------------------------------------------------------------------------------------- SUB APPEND (VAR STRING ABC$; LONG LENABC, IO, SEK_ADR) ' begin task APPEND STRING CHAR$(100) ' for received data CHAR$ = "" ' initialize receive string WHILE CHAR$ = "" ' while receive string empty GET #IO, #SEK_ADR, 0, CHAR$ ' read (chars) from I/O channel ENDWHILE ' CHAR$ = CONVERT7$ (CHAR$, NO_CTRL7$) ' <-- delete CTRL characters ABC$ = RIGHT$ (ABC$ + CHAR$, LENABC) ' <-- new output string END ' end of task APPEND