1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

PIC plus-5110 LCD-GPS-BMP280-HMC5983

Discussion in 'Oshonsoft' started by camerart, Mar 12, 2017.

  1. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Morning E,
    I see!
    The vague '?' in SIM is coming back to me now.
    You must have an encyclopeadic memory. I'm envious.
    I presume that one of the 'char = RCREG' lines isn't needed?
    Thanks,
    C.
     
  2. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi E,
    I've modified the program at #219 slightly.
    When sending a $GPGGA,???????????????????????????????????????47? message the hardware UART stalls, with $ in RX buffer 2------G in RX buffer 1---------RX shift reg empty.

    Any ideas?
    C.
     
  3. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,354
    Likes:
    650
    Location:
    Ex Yorks' Hants UK
    hi,
    This is correct.??
    E
    eomsg:
    If str1(5) = 0x47 Then 'G'
    If button = 0 Then Goto time
    '''Lcdcmdout LcdClear---------------------------------------
    '''Lcdcmdout LcdLine1Home---------------------------------
    '''Lcdout "LA "------------------------------------------
    For txi = 18 To 29 'LAT
    '''Lcdout str1(txi)------------------------------------
    Next txi
    '''Lcdcmdout LcdLine2Home--------------------------------
    '''Lcdout "LO "-----------------------------------------
    For txi = 31 To 43 'LON
    '''Lcdout str1(txi)---------------------------------------
    Next txi
    For ix = 1 To 72
    Hserout str1(ix) 'show msg--------------------------
    Next ix
    Hserout 0x0d, 0x0a '- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    Endif
     
  4. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10
  5. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    MERRY CHRISTMAS

    Here are two versions of the same program:
    1/ Simulates and shows the rxi variables being written.
    2/ Show message on 5110.
    NOTE:
    For simulation use the $GPGGA including the ? at the end.

    I think ENABLE HIGH and LOW need modifying to work properly.

    For each 5110 test change MENU1 to prove it is writing.

    I'm stuck now, as I don't know how to write variables to the 5110. I hope to show 'say' LONGITUDE = 1234.123

    C
     

    Attached Files:

  6. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,354
    Likes:
    650
    Location:
    Ex Yorks' Hants UK
    hi C,
    If I follow your query correctly?, this what you need to do.

    1. The incoming GPS string is ASCII stored as a string.
    2. Assign this string as msg1 and call Proc wr_msg(xp As Byte, yp As Byte, msg1 As String)

    3. String should display on the 5110 starting at the xp start location.

    4. To get the section of the GPS string use MidStr(GPSstring, start letter Position of the Long value, number of letters in the section)

    Ignore the $ letter
    $GPGGA,000001,5030.000,N,1234.123,W,1,08,0.9,100.0,M,46.9,M,,*47?

    ie: '1' of the 1234.123 , its length is 8, so msg1= MidStr(GPSstring, 24,8) = 1234.123
    then to add the LONGITUDE label

    msg1="LONGITUDE" + msg1
    Proc wr_msg(xp As Byte, yp As Byte, msg1 As String)

    NOTE:
    The GPS string in the original program was stored is a buffer str1(rxi), so you could extract the Long by....
    If you recall we used 'cp' to count the position and occurrence of the ',' because the length of the GPS string varies,

    msg1=""
    for x= 24 to 31
    msg1= msg1+ str1(x)
    next x
    msg1="LONGITUDE" + msg1

    Do you follow OK.
    E
     
  7. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi E,
    Am I correct, that the full program with GPS can't be simulated normally, and needs to be tested in other ways?

    I think you've answered everything. I'll have a go.

    EDIT: Did you see that there is an issue with ENABLE HIGH and ENABLE LOW?

    Thanks, C.
     
    Last edited: Dec 26, 2017
  8. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10
  9. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,354
    Likes:
    650
    Location:
    Ex Yorks' Hants UK
    hi C,
    IIRC we only used Enable HIGH to capture the GPS string.? What are you using the LOW to do.???
    In the later programs, we waited in the 'get_neo' loop for getting the GPS string, you seem to be mixing the two methods.??
    Initially we used the Sim to fully check the program.
    E
     
  10. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi E,
    I'm improving on your abbreviations, if not programming. IIRC 'If I recall' :)

    Yes, I found an old 16F648A program with GPS that I combined with the latest program, so HIGH and LOW were left from that.

    So am I correct that, for this program, I need ENABLE HIGH only?

    I guess that these SPI LCDs can't be simulated, is this correct?

    C.
     
  11. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,354
    Likes:
    650
    Location:
    Ex Yorks' Hants UK
    hi,
    The only way you could see any action on the SPI LCD's is to use the Tools/Scope in the Sim.

    If you are using HIGH Interrupts to capture the GPS string, this is a guide.
    or are you using 'get_neo'?
    E

    On High Interrupt
    Save System

    PIR1.RCIF = 0

    Hserin chr
    If chr = "$" Then 'start
    rxi = 0
    Endif

    str1(rxi) = chr
    Hserout str1(rxi) 'show for testing only
    bcd1(rxi) = chr And 0x0f 'load BCD array
    rxi = rxi + 1

    If chr = "?" Then 'temp LF, get ALL msg before processing
    Hserout CrLf, CrLf
    msgflg = 1
    Endif

    Resume
     
  12. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi E,
    Oshonsoft Scope, OK.

    I think I've got it? I will use 'get_neo' and remove HIGH and LOW.

    Thanks, C.
     
  13. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi E,

    I've searched and not found a clear explanation of 'assign'

    Can you give an example of how this is done, please?

    [[2. Assign this string as msg1 and call Proc wr_msg(xp As Byte, yp As Byte, msg1 As String)]]

    C.
     
  14. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,354
    Likes:
    650
    Location:
    Ex Yorks' Hants UK
    hi c,
    All it means is the text string you want to display has to be called msg1, if you are using Proc wr_msg(xp As Byte, yp As Byte, msg1 As String)
    So assign the name 'msg1' to your GPS text string, so that the Proc recognises it.
    ie: msg1 = your text string

    BTW:
    Don't forget that for doing Maths on the Lat/Long values etc, the GPS string ASCII values have to be converted to BCD values/numbers.
    You can do that using Oshonsoft, or ANDing the ASCII character with 0x0F and multiplying the values [ it is shown in an earlier Basic program]

    E
     

    Attached Files:

  15. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi E,
    In your examples there is: 'Define STRING_MAX_LENGTH = 10' as we already have one for '60', I presume I don't need the '10' one.

    BTW:
    I don't think this PCB will be used to 'do maths' for LAT/LONG values, although I'll find out as it develops.
    C.
     
  16. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,354
    Likes:
    650
    Location:
    Ex Yorks' Hants UK
    hi C,
    The String_len depends upon how you are capturing and saving the GPS string message.
    If you wanted to save all the string as ASCII, you would set the string_len = 80.
    If you are saving the GPS string into an Array buffer, you would use:-
    Dim strxd(80) As Byte 'neo rxd data buffer
    String_len =11' that's the Len of a GPS value ie: 00059.00000

    It's advisable to keep the String Len as short as possible, as it uses the PIC's GPR registers, you don't want to run out of RAM space.

    Note:
    If you are using ASCII strings to send data to the 5110, allow extra String_Len, just enough to hold the longest String message.

    eg:
    msg1="LONGITUDE" + msg1 ' 9 for label, 11 for value = 20

    E
     
  17. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi E,
    I can see that your explanations are comprehensive and clear, but I keep getting tangled.

    Would you edit/ comment out '### all the lines relevant to ARRAYS on the program at #224 please.

    For this project, I'll be using ASCII which will show on the 5110.
    C.
     
  18. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,354
    Likes:
    650
    Location:
    Ex Yorks' Hants UK
    hi C,
    Edited out, but of course it will now not work, may I ask why you want that edit.??
    E
     

    Attached Files:

  19. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi E,
    EDIT: It was needed for me to know 'all' of the ARRAY components.

    Now I see that the STR1 ARRAY is needed for collecting the NMEA, so I've put the lines back in and commented them.

    Am I correct, that now the STR1 ARRAY is saved, it is then 'dissected' by the STRING method you explain? So both ARRAY and STRING are used together, I was trying to eliminate one of them.

    One minute I understand, till I try to write it. I'm sure I'll get it tomorrow.

    Thanks, C.
     
    Last edited: Dec 28, 2017
  20. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,354
    Likes:
    650
    Location:
    Ex Yorks' Hants UK
    hi C,
    Oshonsoft uses STRINGs to store ASCII data.
    WORD will only store 0 thru 65535 decimal, 0xfff.
    E
     
  21. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,833
    Likes:
    11
    Location:
    Dorset UK.
    Hi E,
    I must be getting close, but still not working, and I think I've tried a million versions.

    There are two lines marked by &&&&&&&&&&&&&& are they correct?

    In simulation I can see the end of the NMEA sentence in MENU1, but that's not correct.

    I've changed to TIME instead of LONG (itude), because I get it mixed up with LONG (DIM)

    Can you try this in SIM please?

    C.
     

    Attached Files:

  22. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,354
    Likes:
    650
    Location:
    Ex Yorks' Hants UK
    hi C,
    Downloaded, will let you know tomorrow.
    E

    Fri: working on the program, taking longer than I planned, I will complete later.
    Your original code is not allowing for the changes in GPS string length, I will try to fix that.:)
     
    Last edited: Dec 29, 2017

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice