Discussion in "General help Guidance and Discussion" started by    abbas1707    Aug 8, 2007.
Sat Aug 25 2007, 08:25 pm
#11
hi ajay,
hardware for this project is completed and also i have tested on hyper terminal.every thing working fine.now i want to make vb software for this project.i am thinking to plot the graphs for temperature vs time/date.but its a rough idea.can u provide me some better suggestion??i will be thankful to u...
how can i learn to receive and send characters to serial port in a vb program??can u provide me with any helpful link for it??
thanks in advance... :-|
Sun Aug 26 2007, 12:35 am
#12
abbas i cant see the circuit diagram how to open data logger.dns
file
which software u r using :mad
Sun Aug 26 2007, 12:42 am
#13
@ TPS:
it can be opened by Proteus VSM Simulator software.

Hi abbas,
you can have this sample code for opening/sending/receiving data from the serial port. Once you are able to work on this it will be easy for you to customize it.
The sample GUI code can be downloaded from here
Download Serial communication in VB Sample Code

From the Author: David M. Hitchner

Overview:
The routines in this module facilitate most operations associated with serial communication by encapsulating the API details in easy to call wrapper functions. For example, the CommOpen routine can be used to open and initialize a serial port.

CommOpen takes three parameters: the Port ID mentioned above, a port name such as "COM1" and the desired communication settings (Example: "baud=9600 parity=N data=8 stop=1").

CommOpen checks to see if the specified port is open. If not, it opens it with a call to the CreateFile API for generic read and write access. Next the port's input and output buffers are initialized by calling the SetupComm API followed by a call to PurgeComm. PurgeComm insures the newly created buffers are clean.

After this, the time-out parameters for all of the port's read and write operations are set by populating a COMMTIMEOUTS structure and passing it to the SetCommTimeouts function.

CommOpen now sets the control settings (baud rate, parity, etc.) for the port. To do this the current settings are: retrieved into a DCB (Device-Control Block) structure via GetCommState, modified as desired using a call to BuildCommDCB, and set with the SetCommState function.

Once this is done, the CommWrite routine can be used to write to the port. As you can see, these routines perform the bulk of the work for you. All you need to do is call them appropriately.

See the .BAS module and .TXT file for further details.


For more information there is a text file in it. also.. take a close look at the .bas file which contains the serial module. Hope this will be helpful for you.
 abbas1707 like this.
Tags serial communication with VB softwareVB sample codeVB serial communicationVB MSCOMM
Sun Sep 02 2007, 12:42 pm
#14
unable to attach more than 1 image


[ Edited Sun Sep 02 2007, 12:50 pm ]
Sun Sep 02 2007, 12:46 pm
#15
hi ajay!
first im making logging software for only 1 channel.i have done logging to html file.here are samples of my software

i will make for 8 channels later but first i want to make spread sheet on excel for only 1 sensor.
for this i need your help coz i dnt know how to logg vb data to excel file.can u plz provide me some info about it??
thanx in advance


029C 9/1/2007 10:43:13 PM
030C 9/1/2007 10:43:14 PM
031C 9/1/2007 10:43:15 PM
031C 9/1/2007 10:43:16 PM
031C 9/1/2007 10:43:17 PM
031C 9/1/2007 10:43:17 PM
031C 9/1/2007 10:43:18 PM
031C 9/1/2007 10:43:19 PM
031C 9/1/2007 10:43:20 PM
031C 9/1/2007 10:43:21 PM
031C 9/1/2007 10:43:22 PM


[ Edited Sun Sep 02 2007, 12:56 pm ]
Sun Sep 02 2007, 02:42 pm
#16
here is some notes for you..
read carefully will give you good idea..
Methods for transferring data to Excel from Visual Basic

and a sample code..
Vb to Excel data export

Version Compatibility: Visual Basic 5 Visual Basic 6

More information: The purpose of this programme is to generate report by populating data into an Ms-Excel sheet from an Ms-Access database. It will also display the sub total and grand total of the amount column at runtime, using auto formating technique.



Do share your project after you finish...
Sat Sep 08 2007, 03:20 am
#17
hi ajay,
my project stopped working.i made pcb for it two times,and implemented one time on vero board.
but it works fine for some time and after dat it shows no response.i request u to review my code which i posted before.i dnt understand where the problem is.i have doubt about the clock frequency but not sure.
shud i make some extra circuitry??
also one thing is eating my mind! im making circuit on bread board at this time.but when i implement the code
#include <reg51.h>

void delay()
{
int k,l;
for(k=0;k<50;k++)
for(l=0;l<280;l++);
}
void init()
{
TMOD=0x22;
TH1=0xFD;
SCON=0x50;
TR1=1;
}
void sendChar(unsigned char ch)
{

delay();
delay();
SBUF=ch;
while(TI==0);
TI=0;
}
void main()
{
init();
while(1)
{
sendChar('a');
delay();

}
}
i get aaaa on hyper terminal
but when i burn the program below
#include <reg51.h>
void delay()
{
int k,l;
for(k=0;k<50;k++)
for(l=0;l<280;l++);
}
void init()
{
TMOD=0x22;
TH1=0xFD;
SCON=0x50;
TR1=1;
}
void sendChar(unsigned char ch)
{

delay();
delay();
SBUF=ch;
while(TI==0);
TI=0;
}

void sendString(unsigned char *a)
{
while(*a!='\0')
{
sendChar(*a);
a++;
}
}
void main()
{
init();
while(1)
{
sendString("abbas");
delay();

}
}
i get nothing on hyper terminal
y is it so?? i dnt understand
plz plz tell me what to do
Sat Sep 08 2007, 04:08 am
#18
try changing this
while(*a!='\0')
{
sendChar(*a);
a++;
}

to

while(*a)
{
sendChar(*a++);
}

and tell me the results..
Sat Sep 08 2007, 12:27 pm
#19
nothing new happened wid your code.
also when i bring adc in circuit...sendChar() method stops responding
.wid adc in the circuit i get nothing . :mad :mad
i have changed every thing adc,max32,controller,crystal,capacitor
but
this is the same circuit and program which were giving me
nice output 2 days ago.but i dont know what happend now.
even im unable to print string :mad :mad
wat shud i do.plz help
Sat Sep 08 2007, 02:11 pm
#20
if you are saying that you have changed the circuit too.. then.. probably the programming mistake.. lets solve it.. paste your program again.. i want to see it..
also the circuit..

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm
Bernardwarge
Tue Mar 26 2024, 11:15 am