IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Basic Discussion :

[QBasic] Recevoir de l'information par le port série à tout moment


Sujet :

Basic

  1. #1
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Octobre 2008
    Messages
    2
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2008
    Messages : 2
    Points : 1
    Points
    1
    Par défaut [QBasic] Recevoir de l'information par le port série à tout moment
    Est-ce que quelqu'un sait comment je peut recevoir de l'information par le port série, mais ceci à n'importe quel moment.
    Je programme en basic, mon programme doit exécuter certaine tâche, mais à tout moment, je peut recevoir de l'information par le port série, cette information doit être mise dans un tableau.
    Merci.

  2. #2
    Responsable Purebasic

    Avatar de comtois
    Inscrit en
    Avril 2003
    Messages
    1 261
    Détails du profil
    Informations forums :
    Inscription : Avril 2003
    Messages : 1 261
    Points : 9 924
    Points
    9 924
    Billets dans le blog
    8
    Par défaut
    avec quel langage ?

    En PureBasic oui c'est possible.

    AvailableSerialPortInput() permet de tester si des données sont disponibles.

    ReadSerialPortData() permet de lire les données.

    Tu peux faire ton traitement dans un Thread.
    Vous souhaitez participer à la rubrique PureBasic (tutoriels, FAQ, sources) ? Contactez-moi par MP.

  3. #3
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Octobre 2008
    Messages
    2
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2008
    Messages : 2
    Points : 1
    Points
    1
    Par défaut
    Merci beaucoup pour vos renseignements, mais je possède seulement les langages qbasic et clipper.
    Savez-vous s'il existe des fonctions dans ces langages?

  4. #4
    Membre du Club
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Juin 2008
    Messages
    39
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : Conseil

    Informations forums :
    Inscription : Juin 2008
    Messages : 39
    Points : 57
    Points
    57
    Par défaut
    Salut,

    Qbasic 1,2, 3, 4 c'est bien mais QB45 c'est mieux et QBX 7.0 ou 7.1 c'est pro... (avec Fonctions, Procédures, Sub... Appel Dll, SGBR etc... Pro quoi ! Seul défaut aujourd'hui...Fenêtres, mais Pas Windows) (soutenus par MS jusqu'en 2003). Et disponible maintenant en Freeware... En plus en français et avec des aides très complète. Que je t'engage à exploiter pour répondre à toutes tes questions. Je répète : disponible au téléchargement (ou un autre)
    http://quickbasic.free.fr/
    Ce que je me rappelle, c'est qu'il est possible via : Open "Com:n" as #No
    d'ouvrir un port de communication série et d'envoyer ou recevoir des donnée. J'ai à l'époque transmis et reçus via ligne téléphonique bien longtemps avant internet ! Dans Qb45 et QBX la fonction "On Com(n) Gosub ... bien placée permet d'intercepter les entrées du port COM(n)...
    Mais faut maitriser

    Voilà, voilà ! Pour moi, ton sort est entre tes mains !

  5. #5
    Expert éminent sénior
    Avatar de JML19
    Homme Profil pro
    Retraité : Electrotechnicien Electronicien Informaticien de la SNCF
    Inscrit en
    Décembre 2010
    Messages
    14 932
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Corrèze (Limousin)

    Informations professionnelles :
    Activité : Retraité : Electrotechnicien Electronicien Informaticien de la SNCF
    Secteur : Transports

    Informations forums :
    Inscription : Décembre 2010
    Messages : 14 932
    Points : 23 240
    Points
    23 240
    Billets dans le blog
    10
    Par défaut
    Bonjour

    Voici un programme que j'ai fait en GWBASIC qui récupère des données d'une liaison série et les mets dans des fichiers.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    10 SCREEN 0,0:WIDTH 80
    20 KEY OFF:CLS:CLOSE
    30 LOCATE 12,21:PRINT "ARCHIVAGE des DONNEES re‡ues de COM1":LOCATE 23,48:PRINT "PROGRAMME fait par JML"
    35 FOR I=1 TO 1000:NEXT I:CLS
    40 A!=0:B!=0:C!=0:D!=0:A$="":B$="":W$="":A1=0:B1=0:C1=0:D1=0
    45 B$=INKEY$:IF B$="f" OR B$="F" THEN 490 ELSE 50
    50 OPEN "com1:1200,e,7,1,DS0,CS0,CD0,PE" AS #1
    55 ON ERROR GOTO 500
    56 OPEN "SCRN:" FOR OUTPUT AS #3
    60 LOCATE 25,1:PRINT "-PRCI_1.RES - Sortir TAPEZ [F] - Imprimer TAPEZ [P] Arret Impression TAPEZ [ ]-"
    65 OPEN "C:\SPY\PRCI_1.RES" FOR OUTPUT AS #2
    66 IF LOC (1)<2 THEN B$=INKEY$:IF B$="f" OR B$="F" THEN 490 ELSE IF B$="S" OR B$="s" OR W$="S" THEN B$="":W$="":LOCATE 25,77:PRINT " ":GOTO 66 ELSE IF B$="P" OR B$="p" THEN B$="":W$="P":LOCATE 25,77:PRINT "S":GOTO 66 ELSE 66 ELSE 70
    70 INPUT#1,A$
    75 B$=INKEY$:IF B$="F"OR B$="f"THEN 490 ELSE IF B$="S" OR B$="s" THEN W$="S":LOCATE 25,77:PRINT " ":GOTO 80 ELSE IF B$="P" OR B$="p" THEN W$="P":LOCATE 25,77:PRINT "S":GOTO 80 ELSE IF W$="P" THEN LPRINT A$:GOTO 80 ELSE 80
    80 A!=A!+1
    90 IF A!>25000! THEN A1=1:CLOSE #2:GOTO 200 ELSE 100
    100 PRINT #3,A$:PRINT #2,A$:GOTO 66
    200 OPEN "C:\SPY\PRCI_2.RES" FOR OUTPUT AS #2
    205 LOCATE 25,1:PRINT "-PRCI_2.RES"
    206 IF LOC (1)<2 THEN B$=INKEY$:IF B$="f" OR B$="F" THEN 490 ELSE IF B$="S" OR B$="s" OR W$="S" THEN B$="":W$="":LOCATE 25,77:PRINT " ":GOTO 206 ELSE IF B$="P" OR B$="p" THEN B$="":W$="P":LOCATE 25,77:PRINT "S":GOTO 206 ELSE 206 ELSE 210
    210 INPUT#1,A$
    215 B$=INKEY$:IF B$="F"OR B$="f"THEN 490 ELSE IF B$="S" OR B$="s" THEN W$="S":LOCATE 25,77:PRINT " ":GOTO 220 ELSE IF B$="P" OR B$="p" THEN W$="P":LOCATE 25,77:PRINT "S":GOTO 220 ELSE IF W$="P" THEN LPRINT A$:GOTO 220 ELSE 220
    220 B!=B!+1
    230 IF B!>25000! THEN B1=1:CLOSE #2:GOTO 300 ELSE 240
    240 PRINT #3,A$:PRINT #2,A$:GOTO 206
    300 OPEN "D:\SPY\PRCI_3.RES" FOR OUTPUT AS #2
    305 LOCATE 25,1:PRINT "-PRCI_3.RES"
    306 IF LOC (1)<2 THEN B$=INKEY$:IF B$="f" OR B$="F" THEN 490 ELSE IF B$="S" OR B$="s" OR W$="S" THEN B$="":W$="":LOCATE 25,77:PRINT " ":GOTO 306 ELSE IF B$="P" OR B$="p" THEN B$="":W$="P":LOCATE 25,77:PRINT "S":GOTO 306 ELSE 306 ELSE 310
    310 INPUT#1,A$
    315 B$=INKEY$:IF B$="F"OR B$="f"THEN 490 ELSE IF B$="S" OR B$="s" THEN W$="S":LOCATE 25,77:PRINT " ":GOTO 320 ELSE IF B$="P" OR B$="p" THEN W$="P":LOCATE 25,77:PRINT "S":GOTO 320 ELSE IF W$="P" THEN LPRINT A$:GOTO 320 ELSE 320
    320 C!=C!+1
    330 IF C!>25000! THEN C1=1:CLOSE #2:GOTO 400 ELSE 340
    340 PRINT #3,A$:PRINT #2,A$:GOTO 306
    400 OPEN "D:\SPY\PRCI_4.RES" FOR OUTPUT AS #2
    405 LOCATE 25,1:PRINT "-PRCI_4.RES"
    406 IF LOC (1)<2 THEN B$=INKEY$:IF B$="f" OR B$="F" THEN 490 ELSE IF B$="S" OR B$="s" OR W$="S" THEN B$="":W$="":LOCATE 25,77:PRINT " ":GOTO 406 ELSE IF B$="P" OR B$="p" THEN B$="":W$="P":LOCATE 25,77:PRINT "S":GOTO 406 ELSE 406 ELSE 410
    410 INPUT#1,A$
    415 B$=INKEY$:IF B$="F"OR B$="f"THEN 490 ELSE IF B$="S" OR B$="s" THEN W$="S":LOCATE 25,77:PRINT " ":GOTO 420 ELSE IF B$="P" OR B$="p" THEN W$="P":LOCATE 25,77:PRINT "S":GOTO 420 ELSE IF W$="P" THEN LPRINT A$:GOTO 420 ELSE 420
    420 D!=D!+1
    430 IF D!>25000! THEN D1=1:CLOSE #2:A!=0:A1=0:B!=0:B1=0:C!=0:C1=0:D!=0:D1=0:LOCATE 25,1:PRINT "-PRCI_1.RES":GOTO 65 ELSE 440
    440 PRINT #3,A$:PRINT #2,A$:GOTO 406
    490 CLOSE : SYSTEM
    500 RESUME NEXT
    
    Vous pouvez utiliser les FAQ (ICI) ou les Tutoriels (ICI) et aussi accéder au blog (ICI)

Discussions similaires

  1. Réponses: 10
    Dernier message: 17/07/2010, 10h36
  2. Récupérer le message envoyé par un port série
    Par christophe étudiant dans le forum WinDev
    Réponses: 1
    Dernier message: 14/05/2008, 17h35
  3. Comment envoyer une adresse par le port série
    Par christophe_s46 dans le forum WinDev
    Réponses: 3
    Dernier message: 10/09/2007, 01h52
  4. Réponses: 11
    Dernier message: 08/03/2007, 14h29

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo