'---------------------------------------------------------------------------------------- ' Name: CNT1_L34_L35.TIG ' Type: TIGER-BASIC(tm) Source Code ' Purpose: Counting on L34 + L35 with 1-channel setting of CNT1 device drivers ' ' (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 ' '---------------------------------------------------------------------------------------- ' ' Demo program using the counter device driver CNT1 twice: on L34 and on L35 ' ' Connect: L70 (Pulse out) <-------> L34 Count input (Dev no. #3) ' L71 (Pulse out) <-------> L35 Count input (Dev no. #4) ' ' L6 is used to output the low order COUNT result of L34 ' L8 is used to output the low order COUNT result of L35 ' '---------------------------------------------------------------------------------------- ' ' ' INSTALL_DEVICE #3, "CNT1_345.TDD",0,2 ' Install counter driver with 2 parameters ' ' ' ' !<--- Parameter number in INSTALL_DEVICE ' ! ' ! !<--- This value given to skip this paramater setting ' ! ! ' ! ! ' Parameter: 1. CNT mode: 0=Up count, 1 channel, 1 PIN = Input ' ! 1=Up count, 2 channels, 2 PIN = Input ' ! 2=Up/Down count, 2 pin, Dir0=+ ' ! 3=Up/Down count, 2 pin, Dir0=- ' ! ' Parameter: 2. Trigger in: 0=pos(+), 1=neg(-), 2=both, 3=free running ' '---------------------------------------------------------------------------------------- #INCLUDE DEFINE_A.INC ' USER_EPORT ACT, NOACTIVE ' disable ePort system TASK Main ' begin task MAIN DIR_PIN 7,0,0 ' L70 = Output ==> generate a pulse output DIR_PIN 7,1,0 ' L71 = Output ==> generate a pulse output DIR_PORT 6,0 ' Port 6 = Output ==> show L34 counting result DIR_PORT 8,0 ' Port 8 = Output ==> show L35 counting result INSTALL_DEVICE #2, "TIMERA.TDD",2,250 ' Timebase 10kHz INSTALL_DEVICE #3, "CNT1_345.TDD",0,2 ' Counter driver L34: 0=Count-UP / 1 channel, free running INSTALL_DEVICE #4, "CNT1_354.TDD",0,2 ' Counter driver L35: 0=Count-UP / 1 channel, free running RUN_TASK PULSE_GENERATOR ' start pulse generation on L70 + L71 PUT #3, 0 ' start counter devive #3 PUT #4, 0 ' start counter devive #4 LOOP 999999999 ' many loops GET #3, #0, 0, N1 ' read number of pulses OUT 6, 0FFH, N1 ' show us counter value GET #4, #0, 0, N2 ' read number of pulses OUT 8, 0FFH, N2 ' show us counter value WAIT_DURATION 100 ' wait 100 ms ENDLOOP ' END ' end of task MAIN TASK PULSE_GENERATOR ' Begin task PULSE_GENERATOR LONG N ' WAIT_NEXT 100 ' FOR N = 0 TO 999999999 ' Just many loops OUT 7, 1H, N ' Generate pulses on L70 OUT 7, 2H, N ' Generate pulses on L71 WAIT_NEXT ' NEXT ' END ' End of task PULSE_GENERATOR