Re: RS232 communication & cursor control DLL's ?
From: gp_at_replace-by-the-obvious.com (see.signature_at_hicest.com)
Date: 06/07/04
- Previous message: David Frank: "Re: RS232 communication & cursor control DLL's ?"
- In reply to: William Asher: "Re: RS232 communication & cursor control DLL's ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 7 Jun 2004 05:48:27 -0700
Eric,
Try HicEst (http://www.HicEst.com), a Fortran based interpreter.
The following example is a complete script that
1. gets data via COMport 1
2. interprets the data
3. calls your DLL (if you still need it)
4. plots the data
5. files the data
6. gets the coordinates of a mouse click in the xy graph
7. starts Powerpoint with your data
HicEst is free for short scripts like this, there will be occasional
reminders to register while running longer scripts.
Have fun,
Georg Petrich (mail to: firstname@HicEst.com)
CHARACTER received*1000/'data like 1,1.123,-4.9,4.5 binary or ASCII'/
CHARACTER SomeFileName='SendToPPT.txt'
REAL :: xyz(1000)
WINDOW(WIN=echoHandle, Title='Receive serial port echos', y=1)
WINDOW(WIN=graph, Title='to plot the xyz received', x=1, y=1)
! plot mouse sensitive xy graph with a minutes:seconds x-axis:
AXIS(WIN=graph, Scroll=1, T='mm:SS', MSC=Callback, MouseX=X, MousY=Y)
OPEN(File=SomeFileName)
! port=1, 9600 Baud, odd parity, 8 DataBits, 1 StopBit, echo ON:
COM(Comport=1, Bds=9600, Pty='Odd', Dbits=8, Sbits=1)
DO try = 1, 1E300 ! almost "forever"
! send '?', wait 500 msec for '!', 8Bit checksum, get string,
! evaluate the checksum, send 'OK'
! if any error occurs, execution restarts with item 1:
COM(OnErr=1, Echo=echoHandle, Send='?', Tim=500, Wait='!',
CheckBits=8, Receive=received, ChkSum, Send='OK')
! no error occured, evaluate received string:
READ(Text=received, Items=n) xyz ! list directed, n items received
IF( n > 0 ) THEN
! do whatever you like, e.g. call your DLL or write to file:
result = DLL(Name="yourDLL.dll", Fnc="anything", Arg=n, A=xyz)
TIME(TO, Excel=day) ! MS formatted day with time as fraction
LINE(x=MOD(day,1), y=ReceivedData) ! n data points vs time
ALIAS(xyz,1, ReceivedData,n) ! "dynamic equivalence"
WRITE(File=SomeFileName) n, ReceivedData
ENDIF
SYSTEM(Wait=300) ! 300 msec, give it a little time
ENDDO
END
SUBROUTINE Callback() ! called when xy graph area is clicked
! without USE or dummy parameters: all names global
AXIS(WIN=graph, Scroll=1, Time='mm:SS', MSC=Callback, MSX=X,MSY=Y)
rc = DLG(Txt=X, T=Y, Button='&OK', Btn='2:&PowerPoint') ! dialog
WRITE(File=SomeFileName, Flush=1) ! flush data to disk, dont close
! call Powerpoint:
IF(rc == 2 ) SYSTEM(Shell='POWERPNT.EXE', CMD=SomeFileName)
END
William Asher <gcnp58@yahoo.com> wrote in message news:<Xns95009807D4669FkldeltaC@140.142.17.40>...
> Erik wrote:
>
> > Hi,
> > I'm looking for Fortran code that allows me to communicate with the
> RS232
> > port.
> > Also, I'm looking for advice on how to control the position of the
> > mouse-cursor, based on input from the RS232 port.
> > All of this preferably in combination with Powerpoint.
> >
> > I'm more or less a novice as far as computers are concerned - got some
> > experience in writing Fortran code and compiling it as a DLL. I'm kinda
> > hoping the things mentioned above can be done by calling a (known or
> > to-be-written) DLL
> >
> > thanks a lot
> > Erik
> >
> >
> >
>
> Erik:
>
> Is there a particular reason you want to do this in fortran and not use
> VBA? There are lots of serial communication packages for VBA out there.
> I like fortran, but doing a serial communications application in
> powerpoint using fortran seems like a difficult way to go about things.
> Sort of like going into a machine shop and making a special tool to
> loosen a hex-head bolt.
- Previous message: David Frank: "Re: RS232 communication & cursor control DLL's ?"
- In reply to: William Asher: "Re: RS232 communication & cursor control DLL's ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]