Author |
Topic: Serial port pin driving an interrupt (Read 6304 times) |
|
manxman
Developer
member is offline


Gender: 
Posts: 21
|
 |
Re: Serial port pin driving an interrupt
« Reply #22 on: Jan 15th, 2013, 11:03am » |
|
Having been away from my desk for some time I have now had a chance to evaluate your alternative solution to this timing problem.
For those new to this thread, the circa 20Hz data stream from my seismometer circuit board is input via the COM1 serial port, with 1 pulse per second TTL pulses from a GPS module also being applied to pin 6 (DSR). Since this bare circuit board does not sense ground motion, the seismic signals remain fixed at 1027 and 0 in this instance. I have changed your program to write data to file and a sample of the results of a test are:
Seconds Velocity Beam 3743.913 1027 0 3743.964 1027 0 3744.015 1027 0 3744.064 1027 0 3744.115 1027 0 3744.166 1027 0 3744.217 1027 0 3744.267 1027 0 3744.317 1027 0 3744.368 1027 0 3744.419 1027 0 3744.469 1027 0 3744.52 1027 0 3744.57 1027 0 3744.621 1027 0 3744.671 1027 0 3744.722 1027 0 3744.772 1027 0 3744.823 1027 0 3744.873 1027 0 3744.924 1027 0 3744.975 1027 0 3745.025 1027 0 3745.075 1027 0 3745.126 1027 0 3745.177 1027 0 3745.228 1027 0 3745.277 1027 0 3745.328 1027 0 3745.379 1027 0 3745.43 1027 0 3745.479 1027 0 3745.53 1027 0 3745.581 1027 0 3745.632 1027 0 3745.682 1027 0 3745.732 1027 0 3745.783 1027 0 3745.834 1027 0 3745.884 1027 0 3745.935 1027 0 3745.985 1027 0 3746.036 1027 0 3746.086 1027 0 3746.137 1027 0 3746.187 1027 0 3746.238 1027 0
Excellent! The milliseconds accumulate linearly between PPS pulses in the manner expected. I don't fully understand the workings of your code, however, since many of the instructions are unfamiliar. Where, for example, is the DSR pin assignment made?
On another tack, I have struggled to configure @% to ensure 3 decimal places, including instances when the third significant figure is zero. With @%=&20305 the number 123.45 converts to the string using STR$ as 123.450 but when this string is written to a disk file it appears as 123.45
Many thanks for you expert help with this timing topic.
Regards,
Manxman
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: Serial port pin driving an interrupt
« Reply #23 on: Jan 15th, 2013, 1:10pm » |
|
on Jan 15th, 2013, 11:03am, manxman wrote:| many of the instructions are unfamiliar |
|
I do hope you will make an effort to understand them. The Windows APIs are used exactly as they are documented on MSDN.
Quote:| Where, for example, is the DSR pin assignment made? |
|
Here (both the input signal PPS_Status% and the event PPS_Event% must be changed):
Code: PPS_Status% = MS_RLSD_ON
PPS_Event% = EV_RLSD I set it to RLSD because that's where my MSF data arrives and I certainly didn't want to re-wire the plug!
Quote:| With @%=&20305 the number 123.45 converts to the string using STR$ as 123.450 |
|
I don't think that can be right. If you don't set the STR$ bit in @% STR$ should use the default G9 format, which is 123.45, as it says here:
http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin6.html#strformat
"Byte 3 affects the format of the string generated by the STR$ function. If Byte 3 is 1 the string will be generated according to the format set by @%, otherwise the G9 format will be used".
Richard.
|
|
Logged
|
|
|
|
manxman
Developer
member is offline


Gender: 
Posts: 21
|
 |
Re: Serial port pin driving an interrupt
« Reply #24 on: Jan 15th, 2013, 5:29pm » |
|
Thanks for the clarification.
I will continue experimenting with your improved timing code which, I expect, will now form the basis of timestamping for my seismometer array data.
I'll have another look at the use of @% in order to try and force all string output to format to 3 decimal places.
Regards,
Manxman
|
|
Logged
|
|
|
|
|