Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 08, 2016, 05:03:38 17:03


Login with username, password and session length


Pages: [1]
Print
Author Topic: Reading data from a file in Proteus VSM?  (Read 6075 times)
0 Members and 1 Guest are viewing this topic.
yasir9909
Active Member
***
Offline Offline

Posts: 153

Thank You
-Given: 7
-Receive: 107


« on: November 17, 2009, 10:17:26 10:17 »

I have stored GPS data (without parsing) in a text file through hyper terminal in Laptop.
I need to process that data in Proteus Simulation.

I want that data to be read by PIC18F4520 from 'File' model of Proteus and then perform the necessary Parsing for extracting desired information from data strings stored in text file and read from 'File' model in Proteus.

Could somebody please help me in this regard,how to use 'FILE' model in Proteus.

I do not have any idea how to use this 'FILE' model in Proteus for above mentioned purpose
Logged

regards
m.yasir
yasir9909
Active Member
***
Offline Offline

Posts: 153

Thank You
-Given: 7
-Receive: 107


« Reply #1 on: November 19, 2009, 06:01:20 06:01 »

No body know? how to read data from a text file in Proteus using 'FILE' model in Proteus?
I urgently need help on this issue...
Logged

regards
m.yasir
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 3816

Thank You
-Given: 567
-Receive: 2049


There is no evidence that I muted SoNsIvRi


« Reply #2 on: November 21, 2009, 12:37:01 00:37 »

I don't see how you can read a text file with the 18f2445, but you could put your data in say an eprom. and then read that.
Logged

Note: If you have no posts other than, I want or reporting a dead link Then you can't complain If I remove your post So Stop Leeching
johnri
Junior Member
**
Offline Offline

Posts: 52

Thank You
-Given: 21
-Receive: 12


« Reply #3 on: November 21, 2009, 07:24:54 07:24 »

I don't know anything about the FILE model in Proteus,
but I have an idea that might work.

I believe Proteus has a serial port model that can be used to
send data to any micro.

You can use a terminal program to send your text file to the
serial port in Proteus.

Here is a terminal program that you can use for free:
http://hw-server.com/software/termv19b.html

See the attached pic.


Logged
frasenci
Translator
Active Member
***
Offline Offline

Posts: 162

Thank You
-Given: 119
-Receive: 84


« Reply #4 on: November 21, 2009, 11:26:44 11:26 »

As far as I know , the " File Generator " is one way of getting info into simulation , through a Text file.
It is an option for the different signal generators there are.

Attached picture of VSM manual.

Hope it helps you

Greetings
Logged
yasir9909
Active Member
***
Offline Offline

Posts: 153

Thank You
-Given: 7
-Receive: 107


« Reply #5 on: November 21, 2009, 12:23:19 12:23 »

I have got one solution to this issue.I have used Eltima Virtual Serial Port Driver and COMPIM model in Proteus to send text file (upon which GPS data has been saved) through Hyper Terminal to the COMPIM model in Proteus simulation
I have attached snap shots of these entities
Logged

regards
m.yasir
yasir9909
Active Member
***
Offline Offline

Posts: 153

Thank You
-Given: 7
-Receive: 107


« Reply #6 on: November 21, 2009, 01:30:25 13:30 »

One issue with this approach is that i cannot simulate the complete behavior of GPS engine as GPS engine normally update data after one second delay.
However,baud rate may be set at will.

I have used this type of file (generator) model in multisim.where the source generator reading data from the text file needs two columns of data one for time steps and the other for data points corresponding to that time steps.However, GPS data is different from simple two colum data...
« Last Edit: November 21, 2009, 01:33:16 13:33 by yasir9909 » Logged

regards
m.yasir
yasir9909
Active Member
***
Offline Offline

Posts: 153

Thank You
-Given: 7
-Receive: 107


« Reply #7 on: November 21, 2009, 03:55:46 15:55 »

johnri

I have tried to use the 'terminal program' program that you have mentioned about but could not figure it out how to use it...
how to use this terminal program?

I would try it again...
Logged

regards
m.yasir
yasir9909
Active Member
***
Offline Offline

Posts: 153

Thank You
-Given: 7
-Receive: 107


« Reply #8 on: November 23, 2009, 10:43:09 10:43 »

johnri

I have tried this terminal software again,it also requires virtual serial port driver the way i have used,the only difference being that this terminal software may be used in place of hyper terminal that i have used in above mentioned technique
Logged

regards
m.yasir
johnri
Junior Member
**
Offline Offline

Posts: 52

Thank You
-Given: 21
-Receive: 12


« Reply #9 on: November 26, 2009, 12:46:17 00:46 »

@yasir9909

Yes, there is no difference in using the HyperTerminal or the other Terminal program,
I had posted it when I read that you wanted to get a text file into a micro.

I can't think of any way to simulate the periodic outputing of the GPS lines of text.

Maybe you could write a VB program to continuously send a line of GPS text (reading from a file)
after a periodic delay and when that is sent into the Proteus COMPIM serial port it should model the
behavior of a GPS device.

It would be much easier to just get a real GPS device to interface with the Proteus model.
Logged
yasir9909
Active Member
***
Offline Offline

Posts: 153

Thank You
-Given: 7
-Receive: 107


« Reply #10 on: November 26, 2009, 08:48:50 08:48 »

johnri

Well,i am also thinking about physically connecting GSP engine with RS-232 interface to PC and get data directly from GPS engine in Proteus through ComPIM module

I don't know programming in VB.I know only C and C++,can it be done with C and C++ as well...?
I think it can done with C and C++ as well...
Logged

regards
m.yasir
frasenci
Translator
Active Member
***
Offline Offline

Posts: 162

Thank You
-Given: 119
-Receive: 84


« Reply #11 on: November 26, 2009, 01:10:03 13:10 »

Ones I was developing an instrument based on Pocket Pc that received serial data over bluetooth from an 877A Pic based PCB meant to be far away on the machine it was sensing.

1.- For developing the PIC side of the software I simply put TWO PIC processors in the same DSN on Proteus , the second one only run a loop sending the simulated serial data to the MAIN PIC. Connected directly from Tx/Rx pins of each other. Each PIC on proteus can have his own program running. That was great help.

2.- On the Pocket Pc side I used MS Visual Studio , can be VBasic or VC ,C+,... etc. Recommend use Visual Studio 2003 as on recent Framework has complicated things a bit. Can also use same development for generating an Pc side application.

3.- Also developed a Pc side with Labview using VISA Serial interface. This one included as early as Labviev 6.

Just wanted to share my experience and highliting the solution to use 2 PIC in same Proteus simulation, the second one simulating the GPS Satellite sending "ssd ,221, 123, etc,..." data on a timed manner.

Greetings
Francisco


Logged
yasir9909
Active Member
***
Offline Offline

Posts: 153

Thank You
-Given: 7
-Receive: 107


« Reply #12 on: December 07, 2009, 08:00:52 20:00 »

I have got the solution.I have got a friend of mine to develop application for me in VB,which reads GPS data from text file and sends it to the COMPIM port at a baud rate of 4800 and with delay of 1sec between GPS data strings and serves like a virtual GPS.This VB application is used in place of Hyper Terminal in previously mentioned solution

The image of the GUI for this VB application is attached with this post.

I would post the code for this VB application later so that it may be helpful to others as well

regards
m.yasir
Logged

regards
m.yasir
yasir9909
Active Member
***
Offline Offline

Posts: 153

Thank You
-Given: 7
-Receive: 107


« Reply #13 on: December 08, 2009, 11:06:45 11:06 »

Here is the VB code for the above application for GPS data:

Code:

Dim PortNo As Integer
Dim BaudRate As Long
Dim FilePath As String
Dim completeFileData As String
Dim allGPSLines() As String
Dim curLineCounter As Long
Dim totalGPSStrings As Long

Private Sub Baud_Click(Index As Integer)
Select Case Index
Case 0
    BaudRate = 4800
Case 1
    BaudRate = 9600
Case 2
    BaudRate = 19200
Case 3
    BaudRate = 57600
Case 4
    BaudRate = 115200
Case Else
    BaudRate = 4800
End Select

End Sub

Private Sub btnSelectFile_Click()
On Error GoTo ErrorHandler:
Dim readGPSFile As New TextFiles
CommonDialog1.CancelError = True
CommonDialog1.Filter = "Text Files(*.txt)|*.txt|"
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
    FilePath = CommonDialog1.FileName
    btnStart.Enabled = True
    lblPath.Caption = FilePath
    readGPSFile.TextFilePath = FilePath
    completeFileData = readGPSFile.completeFile
    allGPSLines = Split(completeFileData, "$GPGGA")
    totalGPSStrings = UBound(allGPSLines)
    curLineCounter = 0
    lblStatus.Caption = "Total GPS strings: " & totalGPSStrings
    Exit Sub
End If
ErrorHandler:
MsgBox Err.Description
btnStart.Enabled = False
Exit Sub
End Sub

Private Sub btnStart_Click()

On Error GoTo ErrorHandler:
If btnStart.Caption = "Start Sending Data" Then
    MSComm1.CommPort = PortNo
    MSComm1.Settings = BaudRate & ", n, 8, 1"
    MSComm1.PortOpen = True
    curLineCounter = 0
    Timer1.Enabled = True
    btnStart.Caption = "Stop Sending Data"
Else
    btnStart.Caption = "Start Sending Data"
    Timer1.Enabled = False
    MSComm1.PortOpen = False
End If

Exit Sub
ErrorHandler:
MsgBox "Error opening Com port... Either it is not a valid port or is already openend by another application.", vbCritical, "Port Open Error"
MsgBox Err.Description
End Sub

Private Sub ComPort_Click(Index As Integer)
PortNo = Index + 1
End Sub

Private Sub Form_Load()
PortNo = 1
BaudRate = 4800
End Sub

Private Sub Timer1_Timer()
MSComm1.Output = "$GPGGA" & allGPSLines(curLineCounter)
curLineCounter = curLineCounter + 1
lblStatus.Caption = "Sending: " & curLineCounter & "/" & totalGPSStrings
End Sub



Logged

regards
m.yasir
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC