'--------------------------------------------------------------------------- ' pulses.bas ' David Boozer ' 20 April 2006 ' 13 January 2009 (modified, remove unused functions) '--------------------------------------------------------------------------- ' Timing program for for ADwin Gold. '--------------------------------------------------------------------------- ' the timer is a 32-bit register that is incremented every 25 ns ' looping time is (2^32)(25 ns) = 107.4 s '--------------------------------------------------------------------------- import STRING.LI9 dim i,j,k as integer dim v_start, v_step as float dim text[32] as string sub serial_byte_out (n, channel) dim output_0, output, m, bit, code as integer output_0 = peek(204000C0h) or shift_left(1,channel) code = 0200h or shift_left(n,1) for m = 1 to 10 bit = shift_right(code,m-1) and 01 output = output_0 xor shift_left(bit,channel) poke(204000C0h,output) wait(103*40) next endsub sub serial_out (channel) dim char, m as integer for m = 2 to strlen(text)+2 char = text[m] serial_byte_out (char,9) next serial_byte_out (10,9) endsub init: conf_dio(15) ' 15 = 1111b, DIO 0-31 are outputs digout_word(0) event: #include foo.txt