Hi every body,
Well here is a question for people that have experience with the MSX RS232c
interface (and in the ASCII one to be exact :)
I would like to write a program that use a 9600 bauds serial line in
receive
mode only (I do not need to send anything) but I would liek to make the
receiving rouitne to work under interuption, I've search in the ASCII
RS232c
manual I have but everythings are in Japanese and the few machine code
example do not show how to use the interface in the interupt driven mode :(
Any help will be wellcome :) because the program was first designed to run
on PC in BASIC (I don't know C :( But unfortunatly my 486 DX2 66MHz seem
not to be fast enough to handle a serial reception of 9600 bauds while
making some caculation in relation with the byte received!!!! I'm sure that
a simple MSX1 or 2 will be able to do that!!!
Here is an example of what I want to do:
(PC version) ;)
**************** here we go!! **************************************
'**********************************************************************
'
' UN PROGRAMME DE L'AN 2000 QUE J'AI ;)
'
'**********************************************************************
OPEN "COM2:2400,N,8,1" FOR RANDOM AS #1 LEN = 16384
ON COM(2) GOSUB sci
DIM buffer0(0 TO 24) AS INTEGER 'buffer de calcul
DIM buffer1(0 TO 24) AS INTEGER 'buffer de reception
jante = 17 ' jante de 17 pouces
largeur = 190 ' largeur de pneumatique en mm
hauteur = 50 ' hauteur egale a 50% de la largeur
perimetre = (17 * 25.4 + 2 * (190 * (50 / 100))) * 3.1415927#
constante = perimetre * 3600 ' en metre par heure
ad.constante = 5 / 255 'constante de conversion Analogique /
Digital
FOR n = 0 TO 24: buffer1(n) = 0: NEXT n
n3 = 0
n4 = 0
COM(2) ON 'autorise les interuption de COM2
CLS
main:
LOCATE 1, 1
FOR n = 1 TO 15 STEP 2
PRINT "AD"; n \ 2; ":";
PRINT USING "#.##"; (buffer1(n) * 16 + buffer1(n + 1)) *
ad.constante;
PRINT " volt"
NEXT n
n1 = (buffer1(17) * 4096 + buffer1(18) * 256 + buffer1(19) * 16 +
buffer1(20))
PRINT "regime moteur:";
IF n1 = 0 THEN PRINT "0 tr/mn " ELSE PRINT INT(7500000! / n1);
"tr/mn "
n2 = (buffer1(21) * 4096 + buffer1(22) * 256 + buffer1(23) * 16 +
buffer1(24))
PRINT "vitesse:";
IF n2 = 0 THEN PRINT "0 km/h" ELSE PRINT INT(constante / (48 *
n2));
"km/h "
GOTO main
'
' routine de lecture du port serie sous interuption
'
sci:
n3 = ASC(INPUT$(1, #1))
IF n3 = 43 THEN n4 = 0
buffer1(n4) = n3
n4 = n4 + 1
RETURN
******************** THE END *****************************************
as you can see at the start:
OPEN "COM2:2400,N,8,1" FOR RANDOM AS #1 LEN = 16384
2400 bauds and a buffer of 16Kb is the maximum speed I can reach!!!!
sometime the buffer of 16Kb overflow!!!!
I hate PC!!! :(
MSX still the best computer I've ever use! :)
greetings from FRANCE,
Martial.