; Program RecPIC ; ; This program uses the Analogue to Digital Convertor to generate ; 8000, 8 bit samples per second. It sends these via a 115,200bps ; serial port link to a PC. The companion program "RecPIC.exe" will ; convert these samples to a ".au" file. This file can then be played ; via Windows Media Player. ; ; The PIC used is a 16F73. ; Loop length for 8000 samples/sec (125uS) and 20MHz Xtal ; (0.2uS per instruction) is 625 Instructions ; ;Internal File Assignments STATUS .EQU $03 ;Used for Zero bit PORTA .EQU $05 PORTB .EQU $06 PORTC .EQU $07 TXSTA .EQU $18 SPBRG .EQU $19 RCSTA .EQU $18 TXREG .EQU $19 ADRES .EQU $1E ADCON .EQU $1F ;Internal Bit Assignments W .EQU 0 F .EQU 1 GO .EQU 2 ZERO .EQU 2 ;User File Assignments TIMER1 .EQU $21 COUNT .EQU $22 TEMP .EQU $23 ;User Bit Assignments GREEN .EQU 2 RED .EQU 3 ;Program Starts Here!!!!!!!!! .ORG $10 ;Initialise Registers BSF 3, 5 BCF 3, 6 MOVLW $C0 MOVWF PORTC ;PORTC = Output except UART CLRF PORTB ;PORTB = Output MOVLW $FF MOVWF PORTA ;PORTA = Input MOVLW $0A MOVWF SPBRG ;Set Baud Rate to 115200 BSF TXSTA, 2 ;Set Baud Rate to High BCF TXSTA, 4 ;Set Async operation BCF 3, 5 BSF RCSTA, 7 BSF 3, 5 BSF TXSTA, 5 MOVLW $04 MOVWF ADCON BCF 3, 5 MOVLW $80 MOVWF ADCON BSF ADCON, 0 CLRF COUNT ;Time Loop (625 instructions total) LOOP MOVLW $10 MOVWF TIMER1 T0 DECFSZ TIMER1, F GOTO T0 BSF ADCON, GO NOP ;Trimmer NOPs NOP NOP NOP NOP NOP NOP NOP MOVLW $0C MOVWF PORTC MOVLW $BB ;BC+10=CC = 201*3 = 603+22=625 MOVWF TIMER1 T1 DECFSZ TIMER1, F GOTO T1 MOVF ADRES, W MOVWF TXREG IORLW $0F ADDLW $01 BTFSC STATUS, ZERO BCF PORTC, RED ADDLW $10 BTFSC STATUS, ZERO BCF PORTC, GREEN GOTO LOOP .END