'
'This loop calculates each point of the arbitrary waveform.
'It then calls one of several subroutines (depending on what format you
'would like the data in) to send the data to the 4071
NUMPOINTS = 80 | ' Total | number of points generated |
| |
Phase# = 0 | ' Reset | sinewave phase accumulator | to 0 | |
PhaseInc# = 2 * 3.1415926# / NUMPOINTS | ' Phase goes 0 to 2*Pi |
'This loop generates the points and sends them to the 4071 FOR PointNumber = 1 TO NUMPOINTS
'Note: Here we call a function to generate a new point value. Basic returns
'a value from SIN() which ranges from
'your own function here, but be sure that the returned value ranges
'from
'to range from
PointVal = SIN(Phase#)
' Pick one | of the following | subroutines depending | on desired data | format: | |||||
' | GOSUB | SendFloat |
| ' Send Floating Point, | ex: | ||||
| GOSUB SendHex | ' Send Hexadecimal, ex: fed7,124,63c8... |
| ||||||
' | GOSUB | SendInteger | ' | Send Integer, ex: |
| ||||
' | GOSUB | SendBinary | ' | Send Binary, | ie <hi byte>,<low | byte>,... | |||
| Phase# | = Phase# + PhaseInc# | ' | Advance the phase | of our | sinusoid | |||
| NEXT PointNumber |
|
| ' | Continue | loop and | generate more points |
'All points have now been generated and sent to the 4071.
'When the 4071 hasn't received any chars over the serial port for a
'1 second
'generating the waveform.
ArbExit: |
|
CLOSE : SYSTEM | ' Close the comm port and exit the program. |
63
BK Precision 4071 User Manual Rev.2.2