Serial GPS to 20x4 LCD via PIC16f628-04


Closed Thread
Results 1 to 2 of 2
  1. #1
    Almightyrastus's Avatar
    Almightyrastus Guest

    Default Serial GPS to 20x4 LCD via PIC16f628-04

    Hi there, I have been lurking around these forums and others for a while trying to find the bits I need and have steadily reached the tearing my hair out point.

    I have a Fortuna U2 GPS module that outputs an NMEA string serially, I want to grab this string and parse it into the separate sections then output the data to a Powertip PC2004A screen (in 4 bit mode), possibly on separate pages.

    I have been finding various bits and pieces of code here and there for the initialisation of the screen and reading in the data and such but I cannot see how to fit these things together to make a set of code that will work for me and what I need. I have made the required electrical connections to the pic and the screen and now just need to program the code I need.

    Does anyone know of either:

    A set of code that will do this for me or

    Blocks of code that can be fitted together in a logical and simple way to get the code I require?

    A lot of the code I have found so far has little to no commenting in so I have been unable to work out what does what and where (hence the tearing hair out bit).

    Many thanks in advance for any help anyone can give me.

  2. #2
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Serial ops

    First of all, do you need to poll the gps to get the info or does it automatically send the data? If it automatically sends the data, look at the datasheet to determine the format of the string. Then, have your pic wait for the first character of the data string and put the following values into an array. Then just deal with the array. For example: This is using a 16f876a with a 20 mhz osc and the melabs bootloader with microcode studio and PBP, with a 4x20 lcd screen. Also a word of advice, during connection, put a 10uf cap between pins 19 and 20 (or vss and vdd). Now for the code.

    @ device pic16F876A, hs_osc, wdt_on, lvp_off, protect_off
    include "MODEDEFS.BAS"
    define LCD_DREG PORTB
    DEFINE LCD_DBIT 0
    DEFINE LCD_BITS 4
    DEFINE LCD_RSREG PORTC
    DEFINE LCD_RSBIT 2
    DEFINE LCD_EREG PORTC
    DEFINE LCD_EBIT 1
    DEFINE LCD_lines 4
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50
    define OSC 20
    adcon1=7
    gps_data var byte [12] ' this is the array you are putting the data into I assuming the data will fit in the [12], if not just make it bigger.
    '_________________________________________________ ____
    Pause 1000
    lcdout $fe,1

    Start:

    serout2,porta.5,84,[poll command] ' use this line if the gps receiver requires a polling command for data.

    SERIN2 PORTa.4,84,[WAIT(x),STR gps_data\12] 'x being the first part of the serial string.
    lcdout str gps_data\12
    pause 1000
    goto start

    Hopefully this gives you a start. One more thing, the number "84" after the porta.4 and porta.5 is the baud rate number used in serout2 command. It represents 9600 baud, 8 bits, one stop bit, no parity. To change this, look on page 141 of the picbasicpro guide book.

    Travin

Similar Threads

  1. LCD serial backpacks
    By Archangel in forum Serial
    Replies: 67
    Last Post: - 30th December 2010, 04:51
  2. Pic18f452 with 20x4 LCD Help
    By djmachine in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th November 2008, 22:43
  3. Please help with EDE702 - Serial to LCD interface
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th October 2008, 02:48
  4. Gps with 16f628
    By dragons_fire in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 8th June 2006, 03:38
  5. Replies: 2
    Last Post: - 28th April 2006, 12:10

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts