'---------------------------------------------------------------------------------------- ' Name: PLSO2_STRO2_Demo.TIG ' Type: Tiger-BASIC Source Code ' Purpose: Demonstrates use of device drivers "STRO2_xx.TDD": ' Generation of strobe pulses ' ' (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 ' '---------------------------------------------------------------------------------------- ' ' Compiled with Tiger-BASIC 5.01 for BASIC-Tiger AXI-4/4 on Plug & Play Lab. ' ' The drivers "STRO2_xx.TDD" are generating short strobe signals instead of signals ' with defined duty + cycle times. ' ' ' Drivers: "PLSO2_xx.TDD" Drivers: "STRO2_xx.TDD" ' ' ======CYCLE=====> - T R U E signal - ' ===DUTY===> ======CYCLE=====> ' !----------! !-------- !-! !-! ' ! ! ! ! ! ! ! ' -----! !-----! ------! !--------------! !------- ' ' ( P u l s e s ) ( S t r o b e s ) ' ' ' Both polarities are possible as defined in the optional setup parameter of the ' driver install: ' ' ' ======CYCLE=====> - INVERSE signals - ' ===DUTY===> ======CYCLE=====> ' -----! !-----! ------! !--------------! !------- ' ! ! ! ! ! ! ! ' !----------! !-------- !-! !-! ' ' ( P u l s e s ) ( S t r o b e s ) ' ' ' ' INSTALL DEVICE #9, "STRO2_80.TDD",1 ' INVERSE s t r o b e s ' INSTALL DEVICE #19, "STRO2_81.TDD",0 ' TRUE s t r o b e s ' PUT #9, #0, , ' Set STROBE count and cycle time + start ' PUT #9, #1, , ' Set STROBE r e l o a d - count and cycle time ' ' INSTALL DEVICE #8, "PLSO2_82.TDD",1 ' INVERSE signal (duty + cycle) ' INSTALL DEVICE #18, "PLSO2_83.TDD",0 ' TRUE signal (duty + cycle) ' PUT #8, #0, , , ' Set PULSE count and cycle time + start ' PUT #8, #1, , , ' Set PULSE r e l o a d - count and cycle time ' '---------------------------------------------------------------------------------------- ' Read driver secondary address 0: Read no. of pulses remaining to be generated ' ' GET #dev_no, #0, 0, N ' ' N reflects the number of pulses to come from secondary address 0 setting: ' ' 1.) 0 No more pulses ' 2.) nnnn Yes, nnnn more pulses remaining to be generated in output buffer ' 3.) 7FFF FFFF Endless pulse output active now ' '---------------------------------------------------------------------------------------- ' Read driver secondary address 1: Read no. of pulses remaining to be generated in RELOAD buffer ' ' GET #dev_no, #1, 0, N ' ' N reflects the number of pulses set in the RELOAD buffer ' ' 1.) 0 No more pulses ' 2.) nnnn nnnn pulses stored in RELOAD buffer ' 3.) 7FFF FFFF Endless pulse output ' '---------------------------------------------------------------------------------------- ' Read driver secondary address 2: Read no. of pulses remaining from sec. addrs. 0 + 1 combined ' ' GET #dev_no, #2, 0, N ' ' N reflects the number of pulses set in the output + RELOAD buffer added together ' ' 1.) 0 No more pulses ' 2.) nnnn nnnn pulses to come in total ' 3.) 7FFF FFFF Endless pulse output ' '---------------------------------------------------------------------------------------- ' Note: Drivers "STRO2_xx.TDD" consume less CPU time compared to "PLSO2_xx.TDD" types. '---------------------------------------------------------------------------------------- USER_VAR_STRICT ' Check for proper declaration #DEFINE TA 3 ' Dev-No: TimerA #DEFINE PLS0 4 ' Dev-No: Pulse / Strobe out mit TimerA #DEFINE PLS1 5 ' Dev-No: Pulse / Strobe out mit TimerA #DEFINE PLS2 6 ' Dev-No: Pulse / Strobe out mit TimerA '---------------------------------------------------------------------------------------- ' Definitions for device drivers: PLSO2_xx.TDD and STRO2_xx.TDD '---------------------------------------------------------------------------------------- #DEFINE UFCO_PO2_LEVEL 80H ' Set "inactive" level of pulse-out pin #DEFINE UFCO_PO2_STOP 85H ' Stops pulse output: 0 = immediate, ' 1 = on next high, 2 = on next low #DEFINE UFCO_OPL_ADJ 86H ' Set a new number of pulses while running pulse output ' and clear reload buffer setting #DEFINE UFCI_OPL_REST 93H ' Read number of remaining total pulses '---------------------------------------------------------------------------------------- TASK Main ' Beginn Task MAIN ' INSTALL_DEVICE #TA, "TIMERA.TDD",3,125 ' 1.25 kHz / 0.8 ms INSTALL_DEVICE #TA, "TIMERA.TDD",1,125 ' 20 kHz / 50 us 'Pulses + Strobes INSTALL_DEVICE #PLS1, "PLSO2_81.TDD", 1 ' INVERSE pulses INSTALL_DEVICE #PLS2, "PLSO2_82.TDD", 0 ' True pulses ' INSTALL_DEVICE #PLS0, "STRO2_80.TDD", 0 ' True strobes INSTALL_DEVICE #PLS0, "STRO2_80.TDD", 1 ' INVERSE strobes '---------------------------------------------------------------------------------------- ' Set frequency directly: ' ' PUT #TA, #1, ' Secondary address = 1 ' ' FREQUENCY = 0 --> stop Timer-A ' = 1...nnnn --> set possible frequency: 610 Hz ... 20 kHz ' ' If a frequency value is not available exactly, the next ' available higher frequency will be set. ' ' --> byte, word, 24-bit or long values are fine '---------------------------------------------------------------------------------------- PUT #TA, #1, 0 ' Stop Timer A ' PUT #PLS1, #0, count, duty, cycle ' Normal pulse output ' PUT #PLS1, #1, count, duty, cycle ' R e l o a d pulse output PUT #PLS1, #0, 3, 2, 4 ' Start pulse output PUT #PLS2, #0, 11, 1, 2 ' Start pulse output ' PUT #PLS0, #0, steps, cycle ' S t r o b e output PUT #PLS0, #0, 11, 2 ' Start strobe output PUT #TA, #1, 20000 ' Start TimerA @ 20 kHz END '