Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 17:52 25 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Serial input problem (MM)

Author Message
brucepython

Regular Member

Joined: 19/06/2011
Location: Australia
Posts: 64
Posted: 12:41am 10 Mar 2012
Copy link to clipboard 
Print this post

I'm trying to read a serial stream from a GPS "mouse" with the following code:

Open "COM1:4800" As #1
Do
Print Input$(1,#1);
Loop Until 0

It's reading data, but the data makes no sense. The GPS unit is working perfectly with a PICaxe-based display.

The NMEA stream looks fine on the oscilloscope.

If anyone has a suggestion of where I've gone off the rails then I'd appreciate it.

Bruce

Sample hex data:
6D 76 36 2D 96 AD 16 DA 76 56 2D 96 59 BD AE 15 65 4D 3B D6 6D 36 6D AC D9 B2 B3 6D B6 76 6D D9 D9 5A 96 B3 DA DA DA B5 59 57 BD AE B5 2B B6 F6 76 76 AD F6 96 D9 AC 2D AD 76 76 D6 B6 AD D9 F6 DA F6 F6 ED AD 16 D6 5A F6 F6 96 D6 B6 5A BB 95 EB D7 15 C5 F5 B6 F6 76 56 2D 16 F6 96 D9 AC 2D AD 76 76 D6 B6 AD D9 F6 5A ED 36 ED D6 2D ED F6 96 56 D6 AD 5A D6 5A DA D6 56 AD 5AD6 DA 65 79 BD AE 15 65 F5 EB 3B D6 ED ED 6D3 6 6D 16 6D DA DA DA DA DA DAB 6D AD 62 DE DB 62 DE D3 69 5E BB 77 15 F7 15 95 3A 79 9A7 9 DA 79 D9 DA 79 F9 DA 79 D8 FA 79 D9 B9 FA 79 99 3A 79 F9 7A 79 F8 FA 79 F9 D9 9A 79 B9 3A 79 F9 1A 79 F9 3A7 9F 959 9A 79 B9 1A 79 F8 FA 79 98 FA 79 F9 39 9A 79 79 DA B9 17 5E 5E BB 77 15 F7 15 95 3A 79 9A 79 BA 79 D9 DA 79 F8 DA 79 D9 7A79 B9 B9 1A 79 98 DA 79 D9 DA 79 D9F A7 9D
 
boss

Senior Member

Joined: 19/08/2011
Location: Canada
Posts: 268
Posted: 04:58pm 10 Mar 2012
Copy link to clipboard 
Print this post

Hi,

do you use signals on TTL or RS232 level? Remember that TTL defines start bit as logic "0" but on RS232 it is +12V. Simply - RS232 is negated and level shiftet TTL. Another problem could be wrong speed, number of data bits or parity settting. Hope this helps.
 
brucepython

Regular Member

Joined: 19/06/2011
Location: Australia
Posts: 64
Posted: 01:41am 11 Mar 2012
Copy link to clipboard 
Print this post

Thanks boss for those suggestions. The data is definitely at TTL levels so I'll try stripping the start and parity bits (though I'd have thought the the serial input code would do this) and see how that goes. The data shouldn't have any high bits set (which many seem to be in that dump) as it's straight ASCII text with no characters over 126. The speed is definitely 4800 Bd, but I'm unsure about the GPS device's bits and parity settings because its documentation, if it ever existed, is now long gone. Even the code I wrote for the PICaxe seems to have gone into hiding. Unfortunately I have to drive a few hundred km this afternoon to collect various family members so shall have to postpone further twiddling until tomorrow.

I really appreciate your reply - many thanks.

Bruce
 
vk4tec

Senior Member

Joined: 24/03/2012
Location: Australia
Posts: 239
Posted: 09:07am 25 Mar 2012
Copy link to clipboard 
Print this post

Bruce,

Some thoughts

+ Voltages - TTL ? RS232 ?
+ Inverted / non inverted
+ Protocol - Plain text NMEA / Binary ?
+ Speed
+ Parity
+ Stop bits
+ ASYNCH RS232 or USB serial data ?

Are you seeing 8 bits of ASYNCH on your scope ?

I was going to invert some of your data in software but the synch could be anywhere.

Brand of GPS ?

Andrew Edited by vk4tec 2012-03-26
Andrew Rich VK4TEC
www.tech-software.net
 
boss

Senior Member

Joined: 19/08/2011
Location: Canada
Posts: 268
Posted: 03:15pm 25 Mar 2012
Copy link to clipboard 
Print this post

Hi Bruce,

If remember well, the "main" RS232 channel on PICAXE has no RS232 receiver/transmiter chip but just few resistors and diode which means it is definetely working with reverse signal polarity. To be 100% sure you have check Tx on GPS when module is not sending data (idle). The Tx pin in idle state must be on log 1. Serial channel seems to be very simple but some time (wrong setting, inacurate Tx speed)it can be real pain. I'm using Maximite COM2 port for communication with serial LCD/VFD display (send data)and unfortunatelly have no experience with data receiving.

Regards
boss
 
brucepython

Regular Member

Joined: 19/06/2011
Location: Australia
Posts: 64
Posted: 07:56pm 25 Mar 2012
Copy link to clipboard 
Print this post

Thanks, gentlemen. I've been diverted by another project and less-than-perfect health, but shall follow up your suggestions ASAP. I followed up on some of Andrew's suggestions and have established that the data is definitely ASCII, definitely at 4800 and definitely at TTL level.

From what boss has deduced from the PICaxe having no problems, I'll now try tackling the signal polarity. The GPS unit is a Techway TP-051 "mouse". Not the latest and greatest, but very reliable and rugged.

Again, many thanks for your ideas and support.

Bruce
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024