-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBASICQU2.BAS
112 lines (96 loc) · 3.37 KB
/
BASICQU2.BAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
'---------------------------------------------
'PUBLIC DOMAIN
'---------------------------------------------
'*******************************************************************
'********************* JIBBER JABBER *******************************
'*******************************************************************
'*****************************************************
' PSIM-1 (Programmable Synthesizer Interface Module)
'
' Module: PSIM-1 REV1b
' Revision Date: 2004/01/17 5:47 AM
' Processor Type: Basic Micro - Basic Atom Pro24M
'
'
' Basic Program Developed by Grant Richter
' Special thanks to Brice for his assistance.
'
' Description:
' 4 channel chromatic quantizer
' Fast version, latency = 1.3 msec.
'
'*****************************************************
' Basic Micro Atom Pro-24M Configuration
'
' (Note: P0 is I/O 0 and NOT pin 0 on the microprocessor.)
'
' P0 - Analog IN-1 (0-5 VDC)
' P1 - Analog IN-2 (0-5 VDC)
' P2 - Analog IN-3 (0-5 VDC)
' P3 - Analog IN-4 (0-5 VDC)
' P4 - START Button (Momentary Normally Open Switch)
' P5 - STOP Button (Momentary Normally Open Switch)
' P6 - I2C/SDA (Reserved) - J3 Pin 1
' P7 - I2C/SDL (Reserved) - J3 Pin 2
' P8 - AUX (Digital I/O - NO BUFFERING)
' P9 - STOP LED
' P10 - RUN LED
' P11 - DAC - LOADDACS
' P12 - DAC - SERDATA
' P13 - DAC - CLOCK
' P14 - RXD (Reserved) - J5 Pin 1 (Midi)
' P15 - TXD (Reserved) - J5 Pin 2 (Midi)
'*****************************************************
'Define Variables
LOADDACS CON 11 ' Pin OUT to DAC LOADDACS
SERDATA CON 12 ' Pin OUT Serial Data to DAC (16-bit)
CLOCK CON 13 ' Pin OUT to Clock DAC
STOPLED CON 9 ' Red LED
RUNLED CON 10 ' Green LED
BSTART CON 5 ' Start Button
BSTOP CON 4 ' Stop Button
AUX CON 8 ' AUX Jack (unbuffered)
RAWDAC1 VAR WORD ' RAW DAC DATA 1
RAWDAC2 VAR WORD ' RAW DAC DATA 2
RAWDAC3 VAR WORD ' RAW DAC DATA 3
RAWDAC4 VAR WORD ' RAW DAC DATA 4
DAC1V VAR WORD ' DAC Value to be Sent to DAC Channel
DAC2V VAR WORD ' DAC Value to be Sent to DAC Channel
DAC3V VAR WORD ' DAC Value to be Sent to DAC Channel
DAC4V VAR WORD ' DAC Value to be Sent to DAC Channel
ADC1 CON 0
ADC2 CON 1
ADC3 CON 2
ADC4 CON 3
ADC1V VAR WORD 'INPUT A/D BUFFER CH. 1
ADC2V VAR WORD 'INPUT A/D BUFFER CH. 2
ADC3V VAR WORD 'INPUT A/D BUFFER CH. 3
ADC4V VAR WORD 'INPUT A/D BUFFER CH. 4
'*****************************************************
'Initialize Module
DIRS = %1111110000000000 ' Configure Pins 1=input 0=output
OUTS = %1111111111111111 ' Configure State 1=low 0=high
'*****************************************************
LOW STOPLED
HIGH RUNLED
'*******************************************************************
'*************** APPLICATION CODE START ****************************
'*******************************************************************
START:
ADIN ADC1, ADC1V
ADIN ADC2, ADC2V
ADIN ADC3, ADC3V
ADIN ADC4, ADC4V
RAWDAC1=((ADC1V/16)*32)+49152
RAWDAC2=((ADC2V/16)*32)+32768
RAWDAC3=((ADC3V/16)*32)+16384
RAWDAC4=(ADC4V/16)*32
SHIFTOUT SERDATA,CLOCK,4,[RAWDAC1\16]
PULSOUT LOADDACS,1
SHIFTOUT SERDATA,CLOCK,4,[RAWDAC2\16]
PULSOUT LOADDACS,1
SHIFTOUT SERDATA,CLOCK,4,[RAWDAC3\16]
PULSOUT LOADDACS,1
SHIFTOUT SERDATA,CLOCK,4,[RAWDAC4\16]
PULSOUT LOADDACS,1
GOTO START