Source language: Translate to:

A possible plugin for basic Serial Communications purposes

Using NeoBook to control external hardware and devices.

Moderator: Neosoft Support

Re: A possible plugin for basic Serial Communications purpos

Postby ebear » Fri Oct 10, 2014 5:19 pm

Hello David,

Synchronization problem is solved, I'm now reading the right values from the arduino sensor tester.

A screenshot of the testing environment, you will recognize some of your work i think :D

Image

Tomorrow I will test "TX" commands to the Arduino via the plugin.

Regards,

Eric
http://www.lunarsoftware.eu - Lunar Software ERP database Development. Manufacturing processes, Document management, QMS, Stock management. Standalone solutions or connected to Helios Orange and other ERP systems.
User avatar
ebear
 
Posts: 270
Joined: Wed Jan 18, 2012 3:12 am
Location: Vrchlabi - Czech republic

Re: A possible plugin for basic Serial Communications purpos

Postby dec » Fri Oct 10, 2014 5:26 pm

Hello there,

Certainly interesting stuff Eric! I am not an expert but can imagine that join hardware and software means lots of possible solutions. ;)

Thanks very much again Eric. ;)
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: A possible plugin for basic Serial Communications purpos

Postby ebear » Fri Oct 10, 2014 5:43 pm

David,

Till now I used the gtComm plugin (there was nothing else available). The gtComm plugin was a good start, but not maintained anymore, and also the possibilities where not complete.

I developed in the past several solutions with it:

- Automatically testing and adjusting of brake sensors in our production.
- Employee ESD registration (Electronics production Anti static)
- Temperature and Humidity measurement for drying rooms, electronics stocks
....

All above are again saving their values via NeoDBPro in databases for history, Quality, Warranty etc

The connection between software and hardware is really very important for so many proposes.

In combination with your plugin development are the possibilities unlimited :D

Thanks a lot, and I wish you a good night,

Eric
http://www.lunarsoftware.eu - Lunar Software ERP database Development. Manufacturing processes, Document management, QMS, Stock management. Standalone solutions or connected to Helios Orange and other ERP systems.
User avatar
ebear
 
Posts: 270
Joined: Wed Jan 18, 2012 3:12 am
Location: Vrchlabi - Czech republic

Re: A possible plugin for basic Serial Communications purpos

Postby dec » Sat Oct 11, 2014 3:10 am

Hello to all,

ebear wrote:David,

Till now I used the gtComm plugin (there was nothing else available). The gtComm plugin was a good start, but not maintained anymore, and also the possibilities where not complete.

I developed in the past several solutions with it:

- Automatically testing and adjusting of brake sensors in our production.
- Employee ESD registration (Electronics production Anti static)
- Temperature and Humidity measurement for drying rooms, electronics stocks
....

All above are again saving their values via NeoDBPro in databases for history, Quality, Warranty etc

The connection between software and hardware is really very important for so many proposes.

In combination with your plugin development are the possibilities unlimited :D

Thanks a lot, and I wish you a good night,

Eric

+1
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: A possible plugin for basic Serial Communications purpos

Postby dec » Sat Oct 11, 2014 3:14 am

Hello again,

I add some new actions: "npOnCompBreak", "npOnCompRing", "npOnCompRxFlag", "npOnCompTxEmpty", "npOnCompCTSChange", "npOnCompDSRChange" and "npOnCompRLSDChange" in "Events" category.

http://www.neoplugins.com/temp/npComp.zip
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: A possible plugin for basic Serial Communications purpos

Postby michi » Sat Oct 11, 2014 6:11 am

Hi all,

I'm not expert as ebear, but I also tried to test the plugin as promised.

No problem before using onEvent command.

I also buy an Arduino device to start with hardware world. Because I'm still reading starting book to learn something about electronics I test the plugin with a very simple example.

Every 5 second Arduino send to com port "Hello!"

I tried to write a simple software to test it, but it doesn't work. Data arrived breaked.

Using sample pub I've the same result:

Image

could you tell me where my head go crazy?
Michi

Started to use Neobook in 2003 when I was 12 to make interactive books. Coders saw me and smiled.
Nowadays I'm still using Neobook to create advanced and powerful softwares. Coders see me and say: «how did you make that?»
michi
 
Posts: 33
Joined: Wed Jun 25, 2014 3:01 am
Location: Italy

Re: A possible plugin for basic Serial Communications purpos

Postby dec » Sat Oct 11, 2014 6:38 am

Hello,

michi, are you using the "Read string" button of the plugin sample? Note this sample it's not very useful at this time, just test certain actions, but, probably the best way to read the input buffer it's from the "npOnCompRxChar" event/subroutine. On the other hand, may the hardware are sending the message "char by char"? In that case probably the refered event/subroutine are called several times, and you are responsible to join all the chars in order to get the appropiate string. On the other hand, since we deal with ASCII characters, maybe if the hardware send Unicode or something else we can have some problems with it. Anyway try to develop your own test publication, in other words, take care with the currently available sample, because, for example, the "Read string" button cannot be the best sample of a "npComReadString" action usage.

Anyway thanks for your tests michi. ;)
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: A possible plugin for basic Serial Communications purpos

Postby michi » Sat Oct 11, 2014 7:50 am

Hello dec, thanks for your reply. These tests are very interesting and open (as ebear said) a new world for neobook users.

I didn't use the "Read string" button, but npOnCompRxChar.

I quickly wrote a pub test with this problem.

Neobook CODE:
Code: Select all
NBW Publication Source File
(C)2014 NeoSoft Corp.
Title=Pubblicazione di NeoBook senza nome
Language=US
NeoBookVer=5,80
ScreenColors=16777216
ScreenWidth=640
ScreenHeight=480
BkndColor=0
ScreenAutoSize=Yes
LinkColor=16711680
WindowStyle=0
WindowOrder=0
WindowPos=0
WindowProps=31
BiDiMode=0
UseUpdateTimer=Yes
ReturnTime=60
SubroutineAction=:test¶npCompReadString "[ARDUINO]" "[count]" "[input]"¶ListBoxAddItem "list" "0" "[input]"¶Return
ShapeTransColor=536870912
SplashProps=3
CompileType=0
MediaType=0
FilesIncluded=1
FontsIncluded=2
CopyExternalFiles=No
SetupMedia=3
SetupInstDir=C:\MieiProgrammi
SetupTitle=Impostazioni
SetupColors=16711680|0|65535
Variables=[dimensioneLettura]¶[eventoArduino]¶[istanzaARDUINO]¶[lettura]¶[risultatoApertura]¶[risultatoChiusura]¶[risultatoOpzioni]¶[stringaRicevuta]¶
VersionMajor=1
VersionMinor=0
VersionRelease=0
VersionBuild=0
ReqExLevel=1
CustomFontName=Arial
CustomFontSize=9
CustomFontStyle=0
CustomCharset=1
CacheSize=30
ExtractOp=132
L_OK=OK
L_CANCEL=Annulla
L_YES=Si
L_NO=No
L_CLOSE=Chiudi
L_ERRORTITLE=Errore
L_FINDTITLE=Cerca
L_FINDPROMPT=&Cosa cercare
L_FINDFIRST=Cerca &primo
L_FINDNEXT=Cerca &successivo
L_FINDERROR=Testo cercato non trovato.
L_PWORDTITLE=Richiesta password
L_PWORDMSG=Per continuare occorre inserire|la password corretta.
L_PWORDPROMPT=Password:
L_PWORDERROR=Password non corretta!
L_MEDIAERROR=Per poter riprodurre questo file è necessario installare|il dispositivo hardware e/o il software adatto.
L_INTERNETERROR=Impossibile accedere al navigatore internet.
L_ABORTFUNCTION=Abbandonare questa funzione?
L_EXTRACTERROR=Impossibile estrarre il file e riprodurlo!
L_INSTDIRPROMPT=Specificare il percorso d'installazione oppure proseguire premendo il tasto invio per accettare le impostazioni preimpostate.
L_INSTFOLDERPROMPT=Creare una cartella per il programma?
L_INSTRUNPROMPT=Avviare
L_INSTDISKPROMPT=Inserire il disco #
L_INSTDISKERROR=Disco non richiesto, riprovare.
L_INSTGENERROR=Installazione completata.
L_INSTEXITPROMPT=Abbandonare l'installazione?
L_INSTWINTITLE=Installazione
L_INSTPROGTITLE=Estrazione dei file in corso...
L_SENDEMAIL=Invio email in corso...
L_MAILSERVER=Inserire il nome del server di posta di uscita (SMTP):
L_COPY=Copia negli Appunti di Windows
L_SELECTALL=Seleziona tutto
L_DONWLOADFILE=Scaricamento in corso: %s
L_PLEASEWAIT=Prego attesa...
TrayMenuBegin
MenuName=TrayOpen
MenuText=Apri
MenuState=3
MenuKey=0
MenuAction=SetVar "[WindowState]" "Normal"
MenuName=TrayExit
MenuText=Esci
MenuState=3
MenuKey=0
MenuAction=Exit "" ""
MenuEnd
MasterPage
NewPage=Nuova pagina
PageStyle=0
PageColor=16777215
PageGradient1=16711680
PageGradient2=255
PageGradientDir=1
WallpaperStyle=0
EffectSpeed=0
ObjectType=3
Name=PulsanteDiComando1
X=17
Y=43
W=260
H=40
Anchor=0
Text=OPEN ARDUINO Communication
Align=2
ImageStyle=0
ObjAction=npCompCreate "[ARDUINO]"¶npCompOpenPort "[ARDUINO]" "COM2" ""¶npOnCompRxChar "[ARDUINO]" "test" "" "[count]" ""
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=2
ObjectType=3
Name=PulsanteDiComando4
X=305
Y=43
W=260
H=40
Anchor=0
Text=CLOSE ARDUINO Communication
Align=2
ImageStyle=0
ObjAction=npCompClosePort "[ARDUINO]" ""
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=1
ObjectType=10
Name=list
X=36
Y=110
W=247
H=353
Anchor=0
VarName=[list]
VarType=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=16777215
FillPattern=1
Font=Arial
FontSize=14
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=3


ARDUINO CODE:
Code: Select all
// setup
void setup() {
  Serial.begin(9600);
}

// loop
void loop() {
  Serial.println("Hello!");
  delay(5000);
}


Maybe ebear, who is already able to receive data from arduino, can help me?

Problem is that for every Arduino's message more than one "test" subroutine is launched (I think). And what about □ character?

Thank you in advance guys
Michi

Started to use Neobook in 2003 when I was 12 to make interactive books. Coders saw me and smiled.
Nowadays I'm still using Neobook to create advanced and powerful softwares. Coders see me and say: «how did you make that?»
michi
 
Posts: 33
Joined: Wed Jun 25, 2014 3:01 am
Location: Italy

Re: A possible plugin for basic Serial Communications purpos

Postby michi » Sat Oct 11, 2014 7:58 am

dec, I forgot to tell you that some evening ago with the alpha version I also tested it with the datalogic powerscan I spoke.

All works very well, next week when work let me breathe I'll test it with npOnCompRxChar.

Image
Michi

Started to use Neobook in 2003 when I was 12 to make interactive books. Coders saw me and smiled.
Nowadays I'm still using Neobook to create advanced and powerful softwares. Coders see me and say: «how did you make that?»
michi
 
Posts: 33
Joined: Wed Jun 25, 2014 3:01 am
Location: Italy

Re: A possible plugin for basic Serial Communications purpos

Postby dec » Sat Oct 11, 2014 10:51 am

Hello,

michi, are you tried without the "delay" in the Arduino code? Try also without the "!" character. I am not sure if we need to deal with the "rare" character in Arduino or in NeoBook (plugin). Maybe you can to change the character set used in Arduino? Remember NeoBook can't deal with Unicode characters: but I am not sure if you can set the character code to ASCII in Arduino. Anyway thanks for your tests, michi. I also appeal to Eric in order to tell us if this things can be "prepared" in Arduino.
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: A possible plugin for basic Serial Communications purpos

Postby dec » Sat Oct 11, 2014 5:11 pm

Hello,

Taking another look at your image, michi, you are received all the "Hello!" message. The "rare" character maybe it's something like a "carriage return" or something like that. And about why the "Hello!" message do not come together, maybe it's something that cannot be controlled easily, in the sense that depend on what Windows make the communication between the device and the program.

In other words, probably you can take the "Hello!" message, just taking care that the message can become not joined, but in separate chars. But you can prepare some "buffer" variable in order to add this chars UNTIL you receive the "!" char. In that point your "buffer" variable contains the entire message and therefore you can doing whatever you wanted. At this time I am not very sure about the "rare" character.

I don't know if this can be controlled by the available options, for example. Or if is the plugin which need to be responsible about this possible characters, or, on the contrary, can be the application which need to take care about that. Anyway what I want to say in this post is that, apparently, you are received the entire "Hello!" message, exactly as you wanted, except than this appear in various separated chars, instead a whole string.
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: A possible plugin for basic Serial Communications purpos

Postby dec » Sun Oct 12, 2014 2:11 am

Hello to all,

I add some new actions: "npCompSignals", "npCompStateFlags" and "npCompTransmitChar" in "Transmission" category.

http://www.neoplugins.com/temp/npComp.zip
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: A possible plugin for basic Serial Communications purpos

Postby michi » Sun Oct 12, 2014 3:00 am

Hi dec, and thanks again for your work.

Delay action in Arduino is used because there we have a loop action repeated thousand of time every second, so if I don't put that command it send to neobook the "Hello!" message many times every second (impossibile to understand what is happening without a delay and seeing neobook debugger).

I've also tried sending a simple "1" but with same results (arrive 1 with □ character or 1 and □ character in other onEvent command) .

there's something that we don't understand, but if ebear already receive data from his Arduino maybe he can solve this problem.

I think that some configuration must be set using npCompSetOptions but I don't now what it is.

we just have to wait an ebear reply.
Michi

Started to use Neobook in 2003 when I was 12 to make interactive books. Coders saw me and smiled.
Nowadays I'm still using Neobook to create advanced and powerful softwares. Coders see me and say: «how did you make that?»
michi
 
Posts: 33
Joined: Wed Jun 25, 2014 3:01 am
Location: Italy

Re: A possible plugin for basic Serial Communications purpos

Postby dec » Sun Oct 12, 2014 3:38 am

Hello,

Probably the "rare" character is a "control character" like a "carriage return" that you can probably simply ignore in this case. Since you can control what the Arduino device send, probably you need to setup a "protocol" between your publication and the Arduino device. What you can doing is to send the string with the suffix "#", for example. So you can send an string like this: "Hello!#".

Then, into the "npOnCompRxChar", you can add to the "buffer" variable every arrived characters, except the "carriage return", and until the "#" is reached. So you can write a code like this in the refered event:

Code: Select all
:OnCompRxChar

  .Read the received chars from the input
  npCompReadString "[CompID]" "[Count]" "[Result]"

  .Trim the received chars
  npTrimStr "[Result]" "[ReceivedChars]"

  .Skip control characters
  If "[ReceivedChars]" "<>" ""
 
    .Look for the end of our transmitted string
    SearchStr "#" "[ReceivedChars]" "[EndTokenPosition]" ""

    If "[EndTokenPosition]" "<>" "0"
      .Get the received chars before the end token is found
      SubStr "[ReceivedChars]" "0" "[EndTokenPosition]" "[EndTokenPosition]"
     
      .Fill our Input buffer variable
      SetVar "[InputBuffer]" "[ReceivedChars]"
     
      .Here our Input buffer variable contains the transmitted string,
      .so we can do whatever thing we need at this point, for example,
      .call a subroutine to make something with the Input buffer.
      GoSub "ProcessInputBuffer"
    EndIf
 
    .Fill our Input buffer variable
    SetVar "[InputBuffer]" "[ReceivedChars]"
  EndIf

Return


As you can see I use the "npTrimStr" action from my npUtil plugin in order to try to remove the possible control characters. I am not sure if the code can works as is, since I can't test it, but the idea is this:

1º Work with certain Input variable to be filled with the received chars

2º Fill the Input variable with all received chars EXCEPT "empty" chars like control characters

3º Take care if the received chars contains our "end of transmission" token ("#" in this case)

4º When the "EOT" token appear, do something with the Input buffer variable

If "Trim" the received chars don't work, maybe you can try to search for "carriage returns" and other possible control characters using some string related functions and the appropiate NeoBook variables like "[#13]". This variable is the ASCII for "carriage return", then, if the received chararacters contains such variable you can replace it by a empty string in order to skip it.

This appear difficult but I think it's more simple than I can explain. However, maybe Arduino provide a way in order to send complete strings, for example. Maybe another mate with experience in that hardware can help us in this case.
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: A possible plugin for basic Serial Communications purpos

Postby ebear » Sun Oct 12, 2014 7:47 am

Hello David, Michi and the rest,

I have also problems with the data transfer. Friday evening I had everything running and It looked fine, but after some changes, I had the same problems as Michi. (Now only knowing what I changed??? :( )
The rest of the weekend i didn't had enough time to really jump deep in the problem. I will now install the latest version of the plugin and do some more tests.
The production version of the tester runs on the moment with the gtComm plugin and works, so it is normal possible. We have to do some more test to help David to debug this great plugin propose.

Regards,

Eric
http://www.lunarsoftware.eu - Lunar Software ERP database Development. Manufacturing processes, Document management, QMS, Stock management. Standalone solutions or connected to Helios Orange and other ERP systems.
User avatar
ebear
 
Posts: 270
Joined: Wed Jan 18, 2012 3:12 am
Location: Vrchlabi - Czech republic

PreviousNext

Return to Neobook and Hardware Control

Who is online

Users browsing this forum: No registered users and 0 guests