Parallax GPS Module?

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Post Reply
everest
Posts: 96
Joined: 31 May 2010, 9:01 AM

Parallax GPS Module?

Post by everest »

Has anyone successfully gotten a Parallax GPS module to work with a Zbasic chip? I'm specifically interested in seeing if I can get the "AppMod" serial interface working correctly. That strikes me as a serious challenge since it's effectively a totally proprietary protocol as far as I can tell.

I saw some code posted by Don on an LCD display and thought maybe someone has similar code for one of those GPS units. Thanks!

-Jeff
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Parallax GPS Module?

Post by dkinzer »

everest wrote:That strikes me as a serious challenge since it's effectively a totally proprietary protocol as far as I can tell.
The software serial channels support a bi-directional half-duplex mode that is compatible with the AppMod interface. This mode is described in the discussion of DefineCom.
- Don Kinzer
everest
Posts: 96
Joined: 31 May 2010, 9:01 AM

Post by everest »

Thanks Don,

I should have read the entire section more closely.

-Jeff
Don_Kirby
Posts: 341
Joined: 15 October 2006, 3:48 AM
Location: Long Island, New York

Post by Don_Kirby »

On a related note, I picked up one of these to play with. Although not the module you're working with, it's worth investigating if you're in the market for an inexpensive GPS module. As I type, the unit is sitting on my desk, a few feet away from the nearest window, with a solid 3D fix, talking TTL serial NMEA to a ZX24n. Setup was a no-brainer using any number of SiRF utilities available (and I'm not even using a windoze machine).

For $35, I don't think this thing can be beat. If my code worked as well as the GPS module, I'd be a happy camper.

-Don
everest
Posts: 96
Joined: 31 May 2010, 9:01 AM

Post by everest »

Yea, those look nice! They weren't available when I bought mine though. I'm really struggling with serial communications, ergh. I understand the basic concepts but I never seem to get anything in the input buffer from my unit....commands must not be going properly or something. I'll try just grabbing NMEA strings next....seems more straightforward!

-Jeff
Don_Kirby
Posts: 341
Joined: 15 October 2006, 3:48 AM
Location: Long Island, New York

Post by Don_Kirby »

everest wrote:I'm really struggling with serial communications,...
In my experience, baud rate and/or protocol mismatch has been the biggest hurdle when it comes to getting serial port communications to work. Before you attempt to interface a serial anything with your micro, connect the device directly to your PC and try to get valid data that way, perhaps using Hyperterminal or something similar. If you can get it to work there, then at least you know the serial port settings to use when you start interfacing with your micro-controller.

-Don
everest
Posts: 96
Joined: 31 May 2010, 9:01 AM

Post by everest »

Great idea!! Thanks!! I'm totally in love with the ZBasic platform, but I have to say, I miss the vast archives of read-to-run code that I could tap into with PBasic and even Arduino. :(

Someone should collect up all the samples that are known to run/work on given chips, sensors, etc. and make an archive. That would be crazy useful and much easier than searching the forums.

On the other hand I get to learn a lot more this way :)

-Jeff
everest
Posts: 96
Joined: 31 May 2010, 9:01 AM

Post by everest »

o I'm giving this another try, and I'm hoping for some supplemental help on the DefineCOM function. I need to set up a single duplex TTL serial I/O line with the following characteristics:

4800bps
8 data bits
no parity
1 stop bit
non-inverted

Those almost map against the system library documentation for DefineCOM, I'm sure I need:

8 data bit bussed mode - &H0c
No parity - &H00
Non-Inverted - &H00

I think that translates into &B00001100 according to the table in the system reference?

So I was thiking someting like this:

Code: Select all

Call DefineCom(3, 11, 11, &B00001100, 1) 
Call OpenCom(3, 4800, inQueue, outQueue)
I'm still not talking to my module with my ZX24r. . .what's wrong with this set-up? Shouldn't that do what's indicated?


-Jeff
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

everest wrote:I'm still not talking to my module with my ZX24r. . .what's wrong with this set-up?
That looks right. What is the VM version on your ZX-24r? The half-duplex support wasn't added until V2.7.0.
- Don Kinzer
everest
Posts: 96
Joined: 31 May 2010, 9:01 AM

Post by everest »

Hey Don,

I got my logic analyzer seeing bytes send by the Stamp2, so I will compare with the bytes sent by my zx24r tonite...that should show the issue. I will post the results and see what u can see. Thanks!

-Jeff
everest
Posts: 96
Joined: 31 May 2010, 9:01 AM

Post by everest »

Hi Don,

I figured it out. . .I was doing something that's not legal I suppose:

Code: Select all

Call PutQueueStr (outQueue, "!GPS" & &H01)


That doesn't work at all. . .

This works just perfectly though:

Code: Select all

Call PutQueueStr (outQueue, "!GPS")
Call PutQueueByte (outQueue, &H01)
-Jeff
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

everest wrote:I was doing something that's not legal I suppose:
It's definitely legal; it just doesn't do what you want. The problem is that the concatenation operator performs automatic type conversion, if necessary, so that both operands are of String type. Consequently, what you wrote is equivalent to:

Code: Select all

Call PutQueueStr (outQueue, "!GPS" & CStr(&H01))
which is also equivalent to:

Code: Select all

Call PutQueueStr (txQueue, "!GPS" & "1")
What you should have used is something like this:

Code: Select all

Call PutQueueStr (outQueue, "!GPS" & Chr(&H01))
- Don Kinzer
everest
Posts: 96
Joined: 31 May 2010, 9:01 AM

Post by everest »

Ahhh. . .so amazingly a command intended to deal with strings, tends to deal with all it's data options as. . . .well. . .strings. . .? LOL. Seems obvious now that you point it out.

-Jeff
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

everest wrote:so amazingly a command intended to deal with strings, tends to deal with all it's data options as. . . .well. . .strings.
The original releases of ZBasic would emit an error message if either of the operands to the concatenation operator were not strings. This was changed some time ago for improved compatibility with Visual Basic which supports automatic value-to-string conversion with the & concatenation operator. Note, however, that you can also use the + operator to concatenate strings and it will not perform automatic value-to-string conversion. Consequently, this code fragment will elicit an error message:

Code: Select all

	Call PutQueueStr (txQueue, "!GPS" + &H01)
This behavior is also compatible with Visual Basic.
- Don Kinzer
Post Reply