Can Fivewin be used for process IO hardware ?

Can Fivewin be used for process IO hardware ?

Postby Marc Venken » Mon Jun 11, 2018 10:34 pm

Just wonder if Fivewin can be used as platform (graphics layout) for processing utilities ?

I'v done some very small testing with Arduino I/O board, but FW is more fun in visuals and keeping data.

At this point I would like to know if I can get FW to know if a beam (ex. laser) is broken by trespassing the laser. The laser can give a electric signal (by a IO port)

Maybe there is some hardware out there that can communicate with FW. I didn't find mutch in the topic.

Just wonder ...

Marc
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Can Fivewin be used for process IO hardware ?

Postby Antonio Linares » Tue Jun 12, 2018 6:45 am

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Can Fivewin be used for process IO hardware ?

Postby Marc Venken » Tue Jun 12, 2018 7:36 am

Yes, this is a point for information about IO and so on.

https://xanthium.in/cross-platform-atti ... rp-dot-net

From the Site :

The Control Software that runs on Windows PC is written in C# and runs on the .Net Framework.
My Q : In the forum I have seens that FW needs activeX and no .net. This is still so anno 2018 ?

Control software is written in C# using Visual Studio community edition IDE.
My Q : Visual studio is also used by people on the forum. So FW can maybe being used to interface ?

This is how the software looks like :

//| Compiler : AVR GCC (WinAVR) |
//| Microcontroller : ATtiny2313A

Code: Select all  Expand view

#include <stdint.h>
#include <avr/io.h>
#include <util/delay.h>
#include "RS485.h"
int main()
{
    char data = ' ';
    uint16_t Baud = 12;             // from datasheet for Clock = 1Mhz,4800bps
   
    DDRB |= (1<<PB2) | (1<<PB3) |(1<<PB4); // PB2,PB3,PB4 all output
    DDRD |= (1<<PD5);                      // PD5 all output
   
    PORTB = 0x00;
    PORTD = 0x00;
   
    RS485_init(12);                 // intialize RS485 Port @4800bps
    while(1)
    {
        data  = RS485_Receive_Byte();   // Wait for PC to send data via  RS485 port
   
        // use a switch to select appropriate action receiving commands from PC
        switch (data)
            {
                case 'A':   PORTB |= (1<<PB3); // Switch ON LED D4
                            break;
                   
                case 'B':   PORTB |= (1<<PB4); // Switch ON LED D5
                            break;
                   
                case 'C':   PORTB |= (1<<PB2); // Switch ON LED D2
                            break;
                   
                case 'D':   PORTD |= (1<<PD5); // Switch ON LED D3
                            break;
                   
                default:    PORTB &= ~(1<<PB3); // Switch OFF LED D4
                            PORTB &= ~(1<<PB4); // Switch OFF LED D5
                            PORTB &= ~(1<<PB2); // Switch OFF LED D2
                            PORTD &= ~(1<<PD5); // Switch OFF LED D3
                            break;
            }//end of switch
    }
    return 0;
   
   
}






//used for indicating where the code is at a given time ,Debugging purpose only
void LED_Debug_Blink(void)
{
    char i = 0;
   
    DDRB  |=  (1<<PB3); // PB3 Output
   
    for(i=0;i<2;i++)
    {
        PORTB |=  (1<<PB3); // PB3 = High,Lights up D4
        _delay_ms(500);
        PORTB &=  ~(1<<PB3); //PB3 = Low,Switch OFF D4
        _delay_ms(500);
    }
   
}

 


Now before I proceed : I have seen FWH connect to different stuff with calls do DLL's and more stuff.

Is it so that if a connection can be make, maybe like above, we could use a Tbtnbmp or other controle and execute it.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Can Fivewin be used for process IO hardware ?

Postby Antonio Linares » Wed Jun 13, 2018 5:29 am

Marc,

You don't need C# at all for this to work:
http://xanthium.in/Serial-Port-Programming-using-Win32-API

C# is based on .NET virtual machine and it is not compatible with Harbour
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Can Fivewin be used for process IO hardware ?

Postby George » Wed Jun 13, 2018 2:01 pm

Antonio,
Could Fivewin for Linux be used for this?
George
 
Posts: 724
Joined: Tue Oct 18, 2005 6:49 pm

Re: Can Fivewin be used for process IO hardware ?

Postby Antonio Linares » Thu Jun 14, 2018 5:57 am

George,

Linux C serial communication with arduino
http://forum.arduino.cc/index.php?topic=45115.0
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Can Fivewin be used for process IO hardware ?

Postby Marc Venken » Thu Jun 14, 2018 10:36 am

Maybe there is a easy way of doing what I want.

I want to count how many times a laserbeam is interupted. With that count, I need to present data on screen with FW.

Fw can open a cashdrawer and also read data from a scanner (barcode)
This is done by COM port.

There is surely hardware on the internet that can give a signal (laser beam) that FW can read from comport.

This idea is correct not ? Than I can look this way. The previous is much more complex.

Marc
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Can Fivewin be used for process IO hardware ?

Postby Marc Venken » Thu Jun 14, 2018 10:46 am

There is a sample from Enrico that read/write to COM

viewtopic.php?f=3&t=4378&hilit=read+comport

A com port is reading text data, but can also read a power signal ? It has to open a cashdrawer with a power signal)

BTW : I have no background on technics...

MENUITEM "DrawerOpen" ACTION Drawer('Open Drawer','COM1',4800,chr(27)+chr(112)+chr(0)+chr(7)+chr(35),'','')

Code: Select all  Expand view

function Drawer(x0,x1,x2,x3,x4,x5)
   local cDcb, nBytes
   local nComm := OpenComm( alltrim(x1),x2, 128 )
   local nError

   if empty(x1) .or. alltrim(x1)='-' .or. alltrim(x1)='SCREEN'
     return .t.
   endif

   if upper(left(x1,3))='LPT'
     BuildCommDcb( alltrim(x1)+":"+str(x2,4)+",n,8,1", @cDcb )
     SetCommState( cDcb )
     cNxLine=CRLF
   else
     if alltrim(x1)<>'SCREEN'
       x3=padl(left(x3,20),20,' ')
       x4=padl(left(x4,20),20,' ')
     endif
     cNxLine=CHR(13)
    if ! BuildCommDcb( alltrim(x1)+":"+str(x2,4)+",n,8,1", @cDcb )
      nError = GetCommError( nComm )
      Msgwait( x0+" : BuildCommDcb Error: " + Str( nError ),'',.3 )
    endif

    if ! SetCommState( cDcb )
      nError = GetCommError( nComm )
      Msgwait( "SetCommState Error: " + Str( nError ),'',.3 )
      return .t.
    endif
   endif

   if !empty(x5)
     for iii=1 to len(x5)
       if ( nBytes := WriteComm( nComm, x5[iii]) ) < 0
         nError = GetCommError( nComm )
         Msgwait( "WriteComm Error: " + Str( nError ),'',.1 )
       else
         Msgwait( x0+' : Ok','',.1 )
       endif
     next
   else
     if ( nBytes := WriteComm( nComm, x3+cNxLine ) ) < 0
       nError = GetCommError( nComm )
       Msgwait( "WriteComm Error: " + Str( nError ),'',.1 )
     else
       Msgwait( x0+' : Ok','',.1 )   // important, do not change the delay
     endif
     if !empty(x4)
       if ( nBytes := WriteComm( nComm, x4+cNxLine ) ) < 0
         nError = GetCommError( nComm )
         Msgwait( "WriteComm Error: " + Str( nError ),'',.1 )
       else
         Msgwait( x0+' : Ok','',.1 )
       endif
     endif
   endif

   if FlushComm( nComm, 0 ) != 0
      nError = GetCommError( nComm )
      Msgwait( x0+" : FlushComm Error: " + Str( nError ),'',.01 )
   endif

   if ! CloseComm( nComm )
      nError = GetCommError( nComm )
      Msgwait( "CloseComm Error: " + Str( nError ),'',.01 )
   endif

return nil

 


So in this code there is the power signal to open the drawer.

This kind of sensor could give a powersignal to the COM port
Image

It is that signal that I want to track and use in a FW app.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Can Fivewin be used for process IO hardware ?

Postby Marc Venken » Thu Jun 14, 2018 11:03 am

Reading about COM port is telling me that I need to look for the right PIN's from the Com-connector. that is used for power signal in/out

Has anyone done this for a application ?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Can Fivewin be used for process IO hardware ?

Postby Marc Venken » Fri Jun 29, 2018 10:57 am

I believe that I have seen gauges and meters somewhere on the forum ?
Anybody now where ?

Meters like this ?

I would like to look into them.

Image
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 88 guests