Smart Port | Wave POD |
waveloop_4 ; loop time is KHz movlw 0x80 ; movwf PORTB ; ; This code is simple in-line setting of the DAC values each 0.4uS for ; a 32 step loop. The values plugged in here are a SINE wave, but may ; be replaced with anything you like. Depending on how much program space ; you have, the number of steps can be anything. Using (say) 100 steps of 1uS ; will give exactly a 10KHz loop. Simply make a table of N values for your ; waveform and edit them into the code. l_41 movlw 153 ; WAV-1 movwf PORTB ; put it to the DAC movlw 177 ; WAV-2 movwf PORTB ; put it to the DAC movlw 199 ; WAV-3 movwf PORTB ; put it to the DAC movlw 219 ; WAV-4 movwf PORTB ; put it to the DAC movlw 234 ; WAV-5 movwf PORTB ; put it to the DAC movlw 246 ; WAV-6 movwf PORTB ; put it to the DAC movlw 253 ; WAV-7 movwf PORTB ; put it to the DAC movlw 255 ; WAV-8 movwf PORTB ; put it to the DAC movlw 253 ; WAV-9 movwf PORTB ; put it to the DAC movlw 246 ; WAV-10 movwf PORTB ; put it to the DAC movlw 234 ; WAV-11 movwf PORTB ; put it to the DAC movlw 219 ; WAV-12 movwf PORTB ; put it to the DAC movlw 199 ; WAV-13 movwf PORTB ; put it to the DAC movlw 177 ; WAV-14 movwf PORTB ; put it to the DAC movlw 153 ; WAV-15 movwf PORTB ; put it to the DAC movlw 128 ; WAV-16 movwf PORTB ; put it to the DAC movlw 103 ; WAV-17 movwf PORTB ; put it to the DAC movlw 79 ; WAV-18 movwf PORTB ; put it to the DAC movlw 57 ; WAV-19 movwf PORTB ; put it to the DAC movlw 37 ; WAV-20 movwf PORTB ; put it to the DAC movlw 22 ; WAV-21 movwf PORTB ; put it to the DAC movlw 10 ; WAV-22 movwf PORTB ; put it to the DAC movlw 3 ; WAV-23 movwf PORTB ; put it to the DAC movlw 1 ; WAV-24 movwf PORTB ; put it to the DAC movlw 3 ; WAV-25 movwf PORTB ; put it to the DAC movlw 10 ; WAV-26 movwf PORTB ; put it to the DAC movlw 22 ; WAV-27 movwf PORTB ; put it to the DAC movlw 37 ; WAV-28 movwf PORTB ; put it to the DAC movlw 57 ; WAV-29 movwf PORTB ; put it to the DAC movlw 79 ; WAV-30 movwf PORTB ; put it to the DAC movlw 103 ; WAV-31 movwf PORTB ; put it to the DAC movlw 128 ; WAV-32 movwf PORTB ; put it to the DAC goto l_41 ; and loop |
Copyright © 2023 BitScope Designs