Hey all,
I will called the routines in the selfcreating but it gives errors
it said not found, what not found?
What do I wrong, I don't find the error !!!!
'Unit
'==========================================================================='
'Read and Write the PC Ports in DOS '
'==========================================================================='
$COMPILE UNIT "PORTS16.PBU"
'Return an byte from the specific port
DECLARE FUNCTION InportB(BYVAL PortAddress AS WORD) AS BYTE
'Return an word from the specific port
DECLARE FUNCTION InportW(BYVAL PortAddress AS WORD) AS WORD
'Write an byte to the specific port
DECLARE SUB OutportB(BYVAL PortAddress AS WORD, BYVAL Value AS BYTE)
'Write an word to the specific port
DECLARE SUB OutportW(BYVAL PortAddress AS WORD, BYVAL Value AS WORD)
SUB OutportB(BYVAL PortAddress AS WORD, BYVAL value AS BYTE)
ASM mov AX, value
ASM mov DX, PortAddress
ASM out DX, AL
END SUB
FUNCTION InportB(BYVAL PortAddress AS WORD) AS BYTE
ASM mov DX, PortAddress
ASM IN AL, DX
ASM mov FUNCTION[0], AL
END FUNCTION
SUB OutportW(BYVAL PortAddress AS WORD, BYVAL value AS WORD) PUBLIC
ASM mov AX, value
ASM mov DX, PortAddress
ASM out DX, AX
END SUB
FUNCTION InportW(BYVAL PortAddress AS WORD) AS WORD
ASM mov DX, PortAddress
ASM IN AX, DX
ASM mov FUNCTION[0], AX
END FUNCTION
'End Unit
'My Application program
========================
'==========================================================================="
' Programma : Servobesturing "
' Copyright : Brainsoft Programmers 2001 "
'==========================================================================="
'======================================="
' Hoofdprogramma "
'======================================="
$COMPILE UNIT "E:\PB35\PB-PBU\PORTS16.PBU"
DECLARE SUB Test()
%BA = &H3F8
DIM Schleifenzeit AS SHARED SINGLE
DIM Ch AS STRING * 1
'Begin
CALL Test
DO
CALL Steuerung
LOOP UNTIL INSTAT
END
'======================================="
' procedure test "
'======================================="
SUB Test
DIM High AS BYTE
DIM Low AS BYTE
DIM m AS WORD
DIM FmtStr AS STRING
$INLINE &HFA 'CLI, interrupt blokkeren
OutportB &H43, &H34 'Timer 0, Mode 2
OutportB &H40, &H00 'Timer 0, low reset
OutportB &H40, &H00 'Timer 0, high reset
FOR m = 1 TO 1000 : NEXT m 'tijdmeting
OutportB &H43, &H04 'Timer 0, bevriezen
Low = InportB(&H40) 'Timer 0, uitlezen
High = InportB(&H40)
$INLINE &HFB 'STI, interrupt vrijgeven
Schleifenzeit = -(Low + 256 * High) / 1000
FmtStr = UNSING$("#####.###",Schleifenzeit)
PRINT "Cyclusduur = " + FmtStr + "æs";
PRINT
END SUB
SUB Impulsgenerator(BYVAL Laenge AS INTEGER)
DIM Anzeit AS WORD
DIM Auszeit AS WORD
DIM Anzahl AS WORD
DIM m AS WORD
Anzeit = ROUND(Laenge / Schleifenzeit)
Auszeit = ROUND(10000 / Schleifenzeit)
$INLINE &HFA
FOR Anzahl = 1 TO 50
OutPortB %BA + 4, 1 'DTR Aan
FOR m = 1 TO Anzeit : NEXT m 'Impulstijd
OutportB %BA + 4, 0 'DTR uit
FOR m = 1 TO Auszeit : NEXT m 'Pauze
NEXT Anzahl
$INLINE &HFB
END SUB
SUB Steuerung
DIM n AS INTEGER
FOR n = 1 TO 10
CALL Impulsgenerator(1000 + n * 100)
NEXT
END SUB
Greetz
Stephane
------------------
ICQ: 123632482
I will called the routines in the selfcreating but it gives errors
it said not found, what not found?
What do I wrong, I don't find the error !!!!
'Unit
'==========================================================================='
'Read and Write the PC Ports in DOS '
'==========================================================================='
$COMPILE UNIT "PORTS16.PBU"
'Return an byte from the specific port
DECLARE FUNCTION InportB(BYVAL PortAddress AS WORD) AS BYTE
'Return an word from the specific port
DECLARE FUNCTION InportW(BYVAL PortAddress AS WORD) AS WORD
'Write an byte to the specific port
DECLARE SUB OutportB(BYVAL PortAddress AS WORD, BYVAL Value AS BYTE)
'Write an word to the specific port
DECLARE SUB OutportW(BYVAL PortAddress AS WORD, BYVAL Value AS WORD)
SUB OutportB(BYVAL PortAddress AS WORD, BYVAL value AS BYTE)
ASM mov AX, value
ASM mov DX, PortAddress
ASM out DX, AL
END SUB
FUNCTION InportB(BYVAL PortAddress AS WORD) AS BYTE
ASM mov DX, PortAddress
ASM IN AL, DX
ASM mov FUNCTION[0], AL
END FUNCTION
SUB OutportW(BYVAL PortAddress AS WORD, BYVAL value AS WORD) PUBLIC
ASM mov AX, value
ASM mov DX, PortAddress
ASM out DX, AX
END SUB
FUNCTION InportW(BYVAL PortAddress AS WORD) AS WORD
ASM mov DX, PortAddress
ASM IN AX, DX
ASM mov FUNCTION[0], AX
END FUNCTION
'End Unit
'My Application program
========================
'==========================================================================="
' Programma : Servobesturing "
' Copyright : Brainsoft Programmers 2001 "
'==========================================================================="
'======================================="
' Hoofdprogramma "
'======================================="
$COMPILE UNIT "E:\PB35\PB-PBU\PORTS16.PBU"
DECLARE SUB Test()
%BA = &H3F8
DIM Schleifenzeit AS SHARED SINGLE
DIM Ch AS STRING * 1
'Begin
CALL Test
DO
CALL Steuerung
LOOP UNTIL INSTAT
END
'======================================="
' procedure test "
'======================================="
SUB Test
DIM High AS BYTE
DIM Low AS BYTE
DIM m AS WORD
DIM FmtStr AS STRING
$INLINE &HFA 'CLI, interrupt blokkeren
OutportB &H43, &H34 'Timer 0, Mode 2
OutportB &H40, &H00 'Timer 0, low reset
OutportB &H40, &H00 'Timer 0, high reset
FOR m = 1 TO 1000 : NEXT m 'tijdmeting
OutportB &H43, &H04 'Timer 0, bevriezen
Low = InportB(&H40) 'Timer 0, uitlezen
High = InportB(&H40)
$INLINE &HFB 'STI, interrupt vrijgeven
Schleifenzeit = -(Low + 256 * High) / 1000
FmtStr = UNSING$("#####.###",Schleifenzeit)
PRINT "Cyclusduur = " + FmtStr + "æs";
END SUB
SUB Impulsgenerator(BYVAL Laenge AS INTEGER)
DIM Anzeit AS WORD
DIM Auszeit AS WORD
DIM Anzahl AS WORD
DIM m AS WORD
Anzeit = ROUND(Laenge / Schleifenzeit)
Auszeit = ROUND(10000 / Schleifenzeit)
$INLINE &HFA
FOR Anzahl = 1 TO 50
OutPortB %BA + 4, 1 'DTR Aan
FOR m = 1 TO Anzeit : NEXT m 'Impulstijd
OutportB %BA + 4, 0 'DTR uit
FOR m = 1 TO Auszeit : NEXT m 'Pauze
NEXT Anzahl
$INLINE &HFB
END SUB
SUB Steuerung
DIM n AS INTEGER
FOR n = 1 TO 10
CALL Impulsgenerator(1000 + n * 100)
NEXT
END SUB
Greetz
Stephane
------------------
ICQ: 123632482
Comment