PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → convert english  code
convert english code
Iniciado por guest, 22,oct. 2015 08:04 - 24 respuestas
Publicado el 22,octubre 2015 - 08:04
bMonPort est un booléen
nNbreOctet est un entier
sMess est une chaîne

//Ouverture du port COM
bMonPort = sOuvre(1, 1024, 1024)
SI bMonPort = Vrai ALORS
//On renseigne les paramètres du modem
sFixeParamètre(12, 9600, 0, 8, 1, Vrai, Vrai, Faux)
//On teste le modem
sEcrit(12, "AT" + Caract(13))
//On laisse au moden le temps de répondre
Temporisation(100)
nNbreOctet = sDansFileEntrée(1)
sMess = sLit(1, nNbreOctet)
//Si la réponse (qui est en fonction du modem) est différente Entrée_OK_Entrée...
SI Majuscule(sMess) <> Caract(13) + Caract(10) + "OK" + Caract(13) + Caract(10) ALORS
Info("Communication avec le terminal impossible !" + RC + " Réseau mauvais ou revérifiez les branchements du modem et sa configuration !")
SINON
//Selon le pays le nombre de chiffre pour composer un numéro
//Pour moi c'est 8, pour la France c'est supérieur dont à changeren fonction
//du pays (ici SAI_N_Téléphone est le champ qui contient le N° de tél
SI Taille(SAI_N_Téléphone) <> 8 ALORS
Info("Numéro de Téléphone érronné ! Vérifier le SVP !")
SINON
Temporisation(100)
//Pour les commandes AT chercher la syntaxe sur le net
sEcrit(12, "AT+CMGS=" + Caract(34) + Droite("09408659688") + Caract(34) + Caract(13))
Temporisation(100)
nNbreOctet = sDansFileEntrée(1)
sMess = sLit(1, nNbreOctet)
SI Majuscule(sMess) <> Caract(13) + Caract(10) + "> " ALORS
Info("Mauvaise initialisation du Modem !")
SINON
Temporisation(100)
sEcrit(1, "vijay" + Caract(26))
// Temporisation(100)
Info("Message envoyer avec succès !")
FIN
FIN
FIN
//On ferme le port
sFerme(1)
SINON
Erreur("Erreur d'ouverture du COM1")
FIN


please convert this code in ENGLISH
Publicado el 22,octubre 2015 - 08:42
Hello Vijay

I think you are missing the point of this forum. You can translate this yourself using any of the translate functions available to you from browsers like Google or Chrome etc. Just type "translate" into the search bar.

Regards
Al
Publicado el 22,octubre 2015 - 09:45
Hi Vijay,

you can search for the french words (SINON for example) in the online help. There you can see the english word. Or you can switch to the english version for more details.
Publicado el 22,octubre 2015 - 09:53
MonPort is boolean
nBytenumber is int
sMess is string
// Open the COM port

bMonPort=sOpen(12,1024, 1024)
IF bMonPort=True THEN
sParameter (12, 9600, 0, 8, 1, True, True, False)
sWrite (12, "AT" + Char (13))
Timeout (100)
nNbreOctet = sDansFileEntrée (1)
sMess = sRead (1,nNbreOctet)
IF Shift (sMess) <> Char (13) + Char (10) + "OK" + Char (13) + Char (10) THEN Info ("not communicate with the terminal" + CR + "bad network or modem recheck the cables and configuration!")

IF NOT Size (SAI_N_Téléphone) <> 10 THEN Info ("Phone Number erroneous! Check Please!")
IF NOT Timeout (100)
sWrite (12, "AT + CMGS =" + Char (34) + Right ("09408659688") + Char (34) + Char (13))
Timeout (100)
nNbreOctet = sDansFileEntrée (1)
sMess = sRead (1,nNbreOctet)
IF Shift (sMess) <> Char (13) + Char (10) + ">" THEN
Info ("Wrong initialization Modem!")
IF NOT Timeout (100)
sWrite (1, "vijay" + Char (26))

Info ("Message sent successfully!")
END
END
END

sClose (1)
IF NOT Error ("Error opening COM1")
END

but give many error
Publicado el 22,octubre 2015 - 09:56
If you are in a code window, there is an option which converts all WINDEV function names from frnech to english or vice versa.
I
Publicado el 22,octubre 2015 - 10:11
//change to com1

bMonPort=sOpen(1,1024, 1024) //you're using com12 ???? sOpen(12,1024, 1024) x
IF bMonPort=True THEN
sParameter (1, 9600, 0, 8, 1, True, True, False)
sWrite (1, "AT" + Char (13))

// as you're using sDansFileEntrée (1) ie sInEntryQueue(1) //com1

HTH

King
Publicado el 22,octubre 2015 - 10:38
MonPort is boolean
nBytenumber is int
sMess is string
// Open the COM port

bMonPort=sOpen(12,1024, 1024)
IF bMonPort=True THEN
sParameter (12, 9600, 0, 8, 1, True, True, False)
sWrite (12, "AT" + Char (13))
Timeout (100)
nNbreOctet = sDansFileEntrée (1)
sMess = sRead (1,nNbreOctet)
IF Shift (sMess) <> Char (13) + Char (10) + "OK" + Char (13) + Char (10) THEN Info ("not communicate with the terminal" + CR + "bad network or modem recheck the cables and configuration!")

IF NOT Size (SAI_N_Téléphone) <> 10 THEN Info ("Phone Number erroneous! Check Please!")
IF NOT Timeout (100)
sWrite (12, "AT + CMGS =" + Char (34) + Right ("09408659688") + Char (34) + Char (13))
Timeout (100)
nNbreOctet = sDansFileEntrée (1)
sMess = sRead (1,nNbreOctet)
IF Shift (sMess) <> Char (13) + Char (10) + ">" THEN
Info ("Wrong initialization Modem!")
IF NOT Timeout (100)
sWrite (1, "vijay" + Char (26))

Info ("Message sent successfully!")
END
END
END

sClose (1)
IF NOT Error ("Error opening COM1")
END

but give many many error
Publicado el 22,octubre 2015 - 10:49
Try this:

bMonPort est un booléen
nNbreOctet est un entier
sMess est une chaîne

//Ouverture du port COM
bMonPort = sOuvre(1, 1024, 1024) //YOU USED COM1, then stick to COM1
SI bMonPort = Vrai ALORS
//On renseigne les paramètres du modem
sFixeParamètre(1, 9600, 0, 8, 1, Vrai, Vrai, Faux) //COM1 NOT COM12
//On teste le modem
sEcrit(1, "AT" + Caract(13)) //COM1
//On laisse au moden le temps de répondre
Temporisation(100)
nNbreOctet = sDansFileEntrée(1)
sMess = sLit(1, nNbreOctet)
//Si la réponse (qui est en fonction du modem) est différente Entrée_OK_Entrée...
SI Majuscule(sMess) <> Caract(13) + Caract(10) + "OK" + Caract(13) + Caract(10) ALORS
Info("Communication avec le terminal impossible !" + RC + " Réseau mauvais ou revérifiez les branchements du modem et sa configuration !")
SINON
//Selon le pays le nombre de chiffre pour composer un numéro
//Pour moi c'est 8, pour la France c'est supérieur dont à changeren fonction
//du pays (ici SAI_N_Téléphone est le champ qui contient le N° de tél
SI Taille(SAI_N_Téléphone) <> 8 ALORS
Info("Numéro de Téléphone érronné ! Vérifier le SVP !")
SINON
Temporisation(100)
//Pour les commandes AT chercher la syntaxe sur le net
sEcrit(1, "AT+CMGS=" + Caract(34) + Droite("09408659688") + Caract(34) + Caract(13)) //COM1
Temporisation(100)
nNbreOctet = sDansFileEntrée(1)
sMess = sLit(1, nNbreOctet)
SI Majuscule(sMess) <> Caract(13) + Caract(10) + "> " ALORS
Info("Mauvaise initialisation du Modem !")
SINON
Temporisation(100)
sEcrit(1, "vijay" + Caract(26))
// Temporisation(100)
Info("Message envoyer avec succès !")
FIN
FIN
FIN
//On ferme le port
sFerme(1)
SINON
Erreur("Erreur d'ouverture du COM1")
FIN
Publicado el 22,octubre 2015 - 11:07
hi kingdr,


give this error "Communication avec le terminal impossible"
Publicado el 22,octubre 2015 - 11:20
Vijay

Why don't you

info(sMess)
//to see any values being read, if so, your COM1 is good
//as your code below don't make sense
// If Majuscule(sMess) , if upper(sMess)<> charact(13)

sMess = sLit(1, nNbreOctet)
//Si la réponse (qui est en fonction du modem) est différente Entrée_OK_Entrée...
SI Majuscule(sMess) <> Caract(13) + Caract(10) + "OK" + Caract(13) + Caract(10) ALORS // else...

If you got your com1 port opened and have some response then it's all
good to go except nobody know the syntax of product that you bought
from microbridge, consult them will be definitive.

Let me know your COM1 response by using info(sMess) and
info(length(sMess)) // if 0 looks NO GOOD at all.

HTH

King
Publicado el 22,octubre 2015 - 11:21
Your modem is connected in the COM1?

What is the content of sMess after the first sEcrit?
Publicado el 22,octubre 2015 - 11:27
Paulo Oliveria,


Connection Ports is ("COM12,COM13")
Publicado el 22,octubre 2015 - 11:53
Why two diferent ports? Normally the device is connected to one port.
If you connect to the device using putty (or some other program) to COM12 and send AT command what happens?
Publicado el 22,octubre 2015 - 12:01
hi,Paulo Oliveira

try this code but give error is "Erreur d'ouverture du COM12
"

bMonPort est un booléen
nNbreOctet est un entier
sMess est une chaîne

//Ouverture du port COM
bMonPort = sOuvre(12, 1024, 1024)
SI bMonPort = Vrai ALORS
//On renseigne les paramètres du modem
sFixeParamètre(12, 9600, 0, 8, 1, Vrai, Vrai, Faux)
//On teste le modem
sEcrit(12, "AT" + Caract(13)) //COM1
//On laisse au moden le temps de répondre
Temporisation(100)
nNbreOctet = sDansFileEntrée(1)
sMess = sLit(1, nNbreOctet)
//Si la réponse (qui est en fonction du modem) est différente Entrée_OK_Entrée...
SI Majuscule(sMess) <> Caract(13) + Caract(10) + "OK" + Caract(13) + Caract(10) ALORS
Info("Communication avec le terminal impossible !")
SINON
//Selon le pays le nombre de chiffre pour composer un numéro
//Pour moi c'est 8, pour la France c'est supérieur dont à changeren fonction
//du pays (ici SAI_N_Téléphone est le champ qui contient le N° de tél
SI Taille(SAI_N_Téléphone) <> 8 ALORS
Info("Numéro de Téléphone érronné ! Vérifier le SVP !")
SINON
Temporisation(100)
//Pour les commandes AT chercher la syntaxe sur le net
sEcrit(12, "AT+CMGS=" + Caract(34) + Droite("09408659688") + Caract(34) + Caract(13)) //COM1
Temporisation(100)
nNbreOctet = sDansFileEntrée(1)
sMess = sLit(1, nNbreOctet)
SI Majuscule(sMess) <> Caract(13) + Caract(10) + "> " ALORS
Info("Mauvaise initialisation du Modem !")
SINON
Temporisation(100)
sEcrit(12, "vijay" + Caract(26))
// Temporisation(100)
Info("Message envoyer avec succès !")
FIN
FIN
FIN
//On ferme le port
sFerme(1)
SINON
Erreur("Erreur d'ouverture du COM12")
FIN
Publicado el 22,octubre 2015 - 12:07
why don't you use erroinfo() in yuor error messages to see the details of the error?

Change your code to something like this:
Erreur("Erreur d'ouverture du COM12",errorinfo())
Publicado el 22,octubre 2015 - 12:10
[attachment 1740 errorwindev.jpg]
Publicado el 22,octubre 2015 - 12:24
Are you running any other software that opens the same port (COM12)?
Publicado el 22,octubre 2015 - 12:38
second error is


"Communication avec le terminal impossible"
Publicado el 22,octubre 2015 - 12:54
What was your solution for the first error?
You have to help us helping you.

What is the content of nNbreOctet and sMess?
Publicado el 22,octubre 2015 - 12:57
nNbreOctet is int ,sMess is string variable
Publicado el 22,octubre 2015 - 13:05
Vijay,
Why only one answer for two questions?

My English may not be very good (google translate sometimes generate strange phrases) but I asked for the content of the vaiables not the data type.

Run your project in debug and post the content of the variables or change your code to
Temporisation(100)
nNbreOctet = sDansFileEntrée(1)
sMess = sLit(1, nNbreOctet)
info(nNbreOctet ,sMess )
and post the print screen.
Publicado el 22,octubre 2015 - 13:12
[attachment 1741 posterror.jpg]
Publicado el 22,octubre 2015 - 13:18
Your modem doesn't send any response, 0 bytes.

Are you sure about the baud rate and all the other parameters of your modem?
Your code is for 9600, what is the modem configuration?
In one of your previous posts you talked about COM12 and COM13, COM12 is the correct port?

PS: Try to answer to all the questions this time.
Publicado el 22,octubre 2015 - 14:26
Modem name:iBall 3.5G Connect
AT port:COM 12
---------------------------------------------------------
IMEI:911118453702191
IMSI:404989868603636
---------------------------------------------------------
Operation info
PIN status:READY OK

Network code:40498
Network mode selection:Auto
Network mode:GSM
Signal strength:31
---------------------------------------------------------
Network status
CS register status:Registered, Home PLMN
PS register status:Registered, Home PLMN
PS network attached:Attached
-----------------------------------------------------
this is
modem setting
Publicado el 22,octubre 2015 - 15:01
Change all ports to 12

nNbreOctet = sDansFileEntrée(12)
sMess = sLit(12, nNbreOctet)

instead of

nNbreOctet = sDansFileEntrée(1) //
sMess = sLit(1, nNbreOctet)

// why still using COM1 as above code????

so does sFerme(12) // no sFerme(1)

nNbreOctet = sDansFileEntrée(12) ....