Continue to Site

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.

  • 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.

PIC plus-5110 LCD-GPS-BMP280-HMC5983

Status
Not open for further replies.
Morning C,
Clip from 18F d/s UART section. page #213.
Explains in the footnote the RCSTA.OERR error sequence.

The 0x0a is the Line Feed code at the end of the RXD msg string, typically 0x0d, 0x0a [ Crlf]
Remember that the Oshonsoft Sim does not add Crlf coding when using the Sim Uart to send a test msg string, so we temporarily used a '?' as a substitute for the Lf 0x0a, ONLY while running in simulation.
The 0x0a detect must be used in an actual PIC code.

E
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.
 
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.
 
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
 
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
 

Attachments

  • 18LF4520 8MHz 5110 NEO8 SML 261217 LCD.txt
    9.1 KB · Views: 205
  • 18LF4520 8MHz 5110 NEO8 SML 261217 SIMULATES.txt
    9 KB · Views: 192
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
 
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:
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
 
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
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.
 
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
 
Hi E,
Oshonsoft Scope, OK.

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

Thanks, C.
 
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.
 
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
 

Attachments

  • A001.gif
    A001.gif
    13.9 KB · Views: 165
  • RangAzimAltElevP11.bas
    9.2 KB · Views: 150
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
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.
 
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
 
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.
 
hi C,
Edited out, but of course it will now not work, may I ask why you want that edit.??
E
 

Attachments

  • 18LF4520 8MHz 5110 NEO8edited1.txt
    9.3 KB · Views: 163
hi C,
Edited out, but of course it will now not work, may I ask why you want that edit.??
E
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:
hi C,
Oshonsoft uses STRINGs to store ASCII data.
WORD will only store 0 thru 65535 decimal, 0xfff.
E
 
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.
 

Attachments

  • 18LF4520 8MHz 5110 NEO8 SML 281217 TEST.txt
    8.9 KB · Views: 174
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:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top