'---------------------------------------------------------------------------------------- ' Name: XSET_XRES_XINV_DEMO_001.TIG ' Type: Tiger-BASIC Source Code ' Purpose: Show new functions XSET, XRES, XINV --> 1-Bit oprations on XPort Outputs ' ' (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 program was compiled with Tiger-BASIC 5.01 or later and TAC System 1.13a ' or later. This demo runs directly on the Plug & Play Lab. Adapt I/O addresses ' of XPorts if using a different environment. ' '---------------------------------------------------------------------------------------- USER_VAR_STRICT ' Variables must be declared TASK MAIN ' Begin task MAIN LONG BASE_ADR, ADR, BIT_ADR ' INSTALL_DEVICE #1, "LCD1.TDD" ' Text-LCD 4 x 20 (BASIC-Tiger) ' INSTALL_DEVICE #1, "LCD1.TDD",0,0,0,0,0,0,80h,8 ' Text-LCD 4 x 20 (TINY-Tiger) '---------------------------------------------------------------------------------------- ' Start with a define bit pattern on these XPorts (always necessary !) '---------------------------------------------------------------------------------------- PRINT #1, "Running ..." ' BASE_ADR = 8 ' Base addr of xPorts here XOUT ( BASE_ADR, "01 03 07 0F 1F 3F 7F FF"%) ' Fill ramp bitpattern to xPorts '---------------------------------------------------------------------------------------- ' Bit inversion loop: 1 Bit at a time gets inverted several times, showing a blinking LED ' After this loop is done, the same bit pattern is seen on the XPorts (LEDs) '---------------------------------------------------------------------------------------- PRINT #1, "Inversion loop" ' FOR BIT_ADR = 0 TO 8*8-1 ' Change 8 bits in 8 Bytes = 64 bits LOOP 3 ' Flash a LED 3-times XINV (BASE_ADR+(BIT_ADR)/8, BIT_ADR BITAND 7H) ' <-- flip a Bit WAIT_DURATION 70 ' XINV (BASE_ADR+(BIT_ADR)/8, BIT_ADR BITAND 7H) ' <-- flip a Bit WAIT_DURATION 70 ' ENDLOOP ' NEXT ' INVERSION-Loop -> same pattern at the end '---------------------------------------------------------------------------------------- ' Bit SET/RES loop: 1 Bit at a time gets SET / RES several times, showing a blinking LED ' After this loop is done, all bits are = 0 (LED turned off) '---------------------------------------------------------------------------------------- PRINT #1, "SET + RESET" ' FOR BIT_ADR = 0 TO 8*8-1 ' Change 8 bits in 8 Bytes = 64 bits LOOP 3 ' Flash a LED 3-times XSET (BASE_ADR+(BIT_ADR)/8, BIT_ADR BITAND 7H) ' <-- SET a Bit WAIT_DURATION 70 ' XRES (BASE_ADR+(BIT_ADR)/8, BIT_ADR BITAND 7H) ' <-- RESET a Bit WAIT_DURATION 70 ' ENDLOOP ' NEXT ' PRINT #1, "------- End -------"; ' END ' End Task MAIN