Keyboard Simulation victory!!
Archiver
Posts: 46,084
Hi Uli,
You might try to eliminate the debug commands,
as they do slow things down. You might want to
output the ascii for the cr directly.
Russ
Original Message
From: "ulibasic" <ulibasic@r...>
To: <basicstamps@yahoogroups.com>
Sent: Wednesday, March 06, 2002 11:36 AM
Subject: [noparse][[/noparse]basicstamps] Keyboard Simulation victory!!
| Hi Stampers,
|
| thanks to your help and another day of trying I solved the problem.
| Simple reason why it didn't work: Bs2 is too slow! Now I am using SX and it
| works!!
| Maybe a Bs2 would be fast enough if I would write a better program...
| The problem is you can't use the shiftout command because the open drain
| connections are shared by the Keyboard and the Stamp, so you have to write a
| program that translates the hex bytes into INPUT and LOW commands on the
| data and clock lines. That takes more time than the PC wants to wait.
|
| You can read my code here and maybe someone has an Idea how to speed it up.
|
| Thanks again for your help and have a nice day!!
|
| uli
|
| _____________
|
| the following program sends x and X in turn to the PC
|
| _____________
|
| zeichen var byte
| clock con 11
| daten con 12
| z1 var bit
| einszaehler var byte
| tempo con 0
|
| dirs=%0000000000000000
|
| debug cls
| debug? in11 'check clock and datalines
| debug? in12
| pause 2000
|
| start:
| zeichen = $12 'keycodes to send makeshift
| gosub hexen
| debug cr
| pause 100
|
|
| zeichen = $22 'keycodes to send make x
| gosub hexen
| debug cr
| pause 100
|
|
| zeichen = $F0 'break x.. and so on
| gosub hexen
| debug cr
| pause 100
|
|
| zeichen = $22
| gosub hexen
| debug cr
|
|
| zeichen = $F0
| gosub hexen
| debug cr
| pause 100
|
|
| zeichen = $12
| gosub hexen
| pause 100
|
| zeichen = $22
| gosub hexen
| debug cr
| pause 100
|
|
| zeichen = $F0
| gosub hexen
| debug cr
| pause 100
|
|
| zeichen = $22
| gosub hexen
| debug cr
|
|
| pause 100
| debug cls
| goto start
|
|
| hexen:
| einszaehler=0 'counter used for parity bit
| gosub nullschieben 'send a 0 as startbit
| z1 = zeichen.bit0
| gosub rausschicken 'send databits
| z1 = zeichen.bit1
| gosub rausschicken
| z1 = zeichen.bit2
| gosub rausschicken
| z1 = zeichen.bit3
| gosub rausschicken
| z1 = zeichen.bit4
| gosub rausschicken
| z1 = zeichen.bit5
| gosub rausschicken
| z1 = zeichen.bit6
| gosub rausschicken
| z1 = zeichen.bit7
| gosub rausschicken
|
| gosub parity 'send parity-bit
| gosub nullschieben 'send stopbit
|
|
| return
|
|
|
|
| rausschicken:
|
|
| branch z1,[noparse][[/noparse]nullschieben,einsschieben] 'send 0 or 1
|
| nullschieben:
| 'debug "0"
|
| low daten
| low clock
| ' clock by going low
| input clock
|
|
| return
|
| einsschieben:
| einszaehler=einszaehler+1 'parity-counter
| 'debug "1"
|
| input daten
| 'see above
| low clock
|
| input clock
|
| return
|
|
|
| parity:
|
| if einszaehler.lowbit=0 then hopp
| gosub nullschieben 'if number of ones odd then
| return 'send zero
| hopp:
| gosub einsschieben
| return
|
|
|
| [noparse][[/noparse]Non-text portions of this message have been removed]
|
|
| To UNSUBSCRIBE, just send mail to:
| basicstamps-unsubscribe@yahoogroups.com
| from the same email address that you subscribed. Text in the Subject and Body
of the message will be ignored.
|
|
| Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|
|
You might try to eliminate the debug commands,
as they do slow things down. You might want to
output the ascii for the cr directly.
Russ
Original Message
From: "ulibasic" <ulibasic@r...>
To: <basicstamps@yahoogroups.com>
Sent: Wednesday, March 06, 2002 11:36 AM
Subject: [noparse][[/noparse]basicstamps] Keyboard Simulation victory!!
| Hi Stampers,
|
| thanks to your help and another day of trying I solved the problem.
| Simple reason why it didn't work: Bs2 is too slow! Now I am using SX and it
| works!!
| Maybe a Bs2 would be fast enough if I would write a better program...
| The problem is you can't use the shiftout command because the open drain
| connections are shared by the Keyboard and the Stamp, so you have to write a
| program that translates the hex bytes into INPUT and LOW commands on the
| data and clock lines. That takes more time than the PC wants to wait.
|
| You can read my code here and maybe someone has an Idea how to speed it up.
|
| Thanks again for your help and have a nice day!!
|
| uli
|
| _____________
|
| the following program sends x and X in turn to the PC
|
| _____________
|
| zeichen var byte
| clock con 11
| daten con 12
| z1 var bit
| einszaehler var byte
| tempo con 0
|
| dirs=%0000000000000000
|
| debug cls
| debug? in11 'check clock and datalines
| debug? in12
| pause 2000
|
| start:
| zeichen = $12 'keycodes to send makeshift
| gosub hexen
| debug cr
| pause 100
|
|
| zeichen = $22 'keycodes to send make x
| gosub hexen
| debug cr
| pause 100
|
|
| zeichen = $F0 'break x.. and so on
| gosub hexen
| debug cr
| pause 100
|
|
| zeichen = $22
| gosub hexen
| debug cr
|
|
| zeichen = $F0
| gosub hexen
| debug cr
| pause 100
|
|
| zeichen = $12
| gosub hexen
| pause 100
|
| zeichen = $22
| gosub hexen
| debug cr
| pause 100
|
|
| zeichen = $F0
| gosub hexen
| debug cr
| pause 100
|
|
| zeichen = $22
| gosub hexen
| debug cr
|
|
| pause 100
| debug cls
| goto start
|
|
| hexen:
| einszaehler=0 'counter used for parity bit
| gosub nullschieben 'send a 0 as startbit
| z1 = zeichen.bit0
| gosub rausschicken 'send databits
| z1 = zeichen.bit1
| gosub rausschicken
| z1 = zeichen.bit2
| gosub rausschicken
| z1 = zeichen.bit3
| gosub rausschicken
| z1 = zeichen.bit4
| gosub rausschicken
| z1 = zeichen.bit5
| gosub rausschicken
| z1 = zeichen.bit6
| gosub rausschicken
| z1 = zeichen.bit7
| gosub rausschicken
|
| gosub parity 'send parity-bit
| gosub nullschieben 'send stopbit
|
|
| return
|
|
|
|
| rausschicken:
|
|
| branch z1,[noparse][[/noparse]nullschieben,einsschieben] 'send 0 or 1
|
| nullschieben:
| 'debug "0"
|
| low daten
| low clock
| ' clock by going low
| input clock
|
|
| return
|
| einsschieben:
| einszaehler=einszaehler+1 'parity-counter
| 'debug "1"
|
| input daten
| 'see above
| low clock
|
| input clock
|
| return
|
|
|
| parity:
|
| if einszaehler.lowbit=0 then hopp
| gosub nullschieben 'if number of ones odd then
| return 'send zero
| hopp:
| gosub einsschieben
| return
|
|
|
| [noparse][[/noparse]Non-text portions of this message have been removed]
|
|
| To UNSUBSCRIBE, just send mail to:
| basicstamps-unsubscribe@yahoogroups.com
| from the same email address that you subscribed. Text in the Subject and Body
of the message will be ignored.
|
|
| Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|
|
Comments
thanks to your help and another day of trying I solved the problem.
Simple reason why it didn't work: Bs2 is too slow! Now I am using SX and it
works!!
Maybe a Bs2 would be fast enough if I would write a better program...
The problem is you can't use the shiftout command because the open drain
connections are shared by the Keyboard and the Stamp, so you have to write a
program that translates the hex bytes into INPUT and LOW commands on the
data and clock lines. That takes more time than the PC wants to wait.
You can read my code here and maybe someone has an Idea how to speed it up.
Thanks again for your help and have a nice day!!
uli
_____________
the following program sends x and X in turn to the PC
_____________
zeichen var byte
clock con 11
daten con 12
z1 var bit
einszaehler var byte
tempo con 0
dirs=%0000000000000000
debug cls
debug? in11 'check clock and datalines
debug? in12
pause 2000
start:
zeichen = $12 'keycodes to send makeshift
gosub hexen
debug cr
pause 100
zeichen = $22 'keycodes to send make x
gosub hexen
debug cr
pause 100
zeichen = $F0 'break x.. and so on
gosub hexen
debug cr
pause 100
zeichen = $22
gosub hexen
debug cr
zeichen = $F0
gosub hexen
debug cr
pause 100
zeichen = $12
gosub hexen
pause 100
zeichen = $22
gosub hexen
debug cr
pause 100
zeichen = $F0
gosub hexen
debug cr
pause 100
zeichen = $22
gosub hexen
debug cr
pause 100
debug cls
goto start
hexen:
einszaehler=0 'counter used for parity bit
gosub nullschieben 'send a 0 as startbit
z1 = zeichen.bit0
gosub rausschicken 'send databits
z1 = zeichen.bit1
gosub rausschicken
z1 = zeichen.bit2
gosub rausschicken
z1 = zeichen.bit3
gosub rausschicken
z1 = zeichen.bit4
gosub rausschicken
z1 = zeichen.bit5
gosub rausschicken
z1 = zeichen.bit6
gosub rausschicken
z1 = zeichen.bit7
gosub rausschicken
gosub parity 'send parity-bit
gosub nullschieben 'send stopbit
return
rausschicken:
branch z1,[noparse][[/noparse]nullschieben,einsschieben] 'send 0 or 1
nullschieben:
'debug "0"
low daten
low clock
' clock by going low
input clock
return
einsschieben:
einszaehler=einszaehler+1 'parity-counter
'debug "1"
input daten
'see above
low clock
input clock
return
parity:
if einszaehler.lowbit=0 then hopp
gosub nullschieben 'if number of ones odd then
return 'send zero
hopp:
gosub einsschieben
return
[noparse][[/noparse]Non-text portions of this message have been removed]